Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ef3faa39e | |||
8c8c0a8c2b | |||
78a72c641f | |||
e18bc58b6c | |||
21f68caf4c | |||
2ef10b4bb2 | |||
5321be46c7 | |||
0f24f9da08 | |||
8ce8492c74 | |||
ee1315929c | |||
9930e6173c |
24
CHANGELOG.md
24
CHANGELOG.md
@ -2,6 +2,30 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
|
||||
[v0.10.6][v0.10.6] (2024-08-30) {#v0.10.6}
|
||||
------------------------------------------
|
||||
|
||||
### Behobene Fehler {#v0.10.6-bugfixes}
|
||||
|
||||
* Der Titel des Flächenbindungs-Fensters (`AreaComAdminWindow`) ist jetzt _Flächenbindungen_, nicht mehr _Lieferungen_. (ee1315929c)
|
||||
* Im Auszahlungsvariante-Fenster (`ChartWindow`) einen Skalierungs-Fehler behoben. ([#33][i33])
|
||||
* Versuch: Fehler bei automatischer Daten-Erneuerung bei längerer Benutzung. (8c8c0a8c2b)
|
||||
|
||||
### Sonstiges {#v0.10.6-misc}
|
||||
|
||||
* SQL-Queries für Auszahlung-Anpassen-Fenster (`PaymentAdjustmentWindow`) und Über-/Unterlieferungen effizienter umgeschrieben. (9930e6173c)
|
||||
* Im Haupt-Fenster (`MainWindow`) den Menüpunkt _Waagen_ zu _Waage_ geändert. (8ce8492c74)
|
||||
* Im Übernahme-Fenster (`DeliveryAdminWindow`) wird in der Teil-Lieferungen-Liste immer die letzte Teil-Lieferung angezeigt. (2ef10b4bb2)
|
||||
* Breite des Traubenanmeldungen-Fensters (`DeliveryAncmtAdminWindow`) leicht erhöht und Fehler beim Enter-Drücken im _Gewicht_ Eingabefeld. (21f68caf4c, e18bc58b6c)
|
||||
* Im Mitglieder-Fenster (`MemberAdminWindow`) wird das ändern der Kontaktart E-Mail wieder farblich hervorgehoben. (78a72c641f)
|
||||
|
||||
[v0.10.6]: https://git.necronda.net/winzer/elwig/releases/tag/v0.10.6
|
||||
[i33]: https://git.necronda.net/winzer/elwig/issues/33
|
||||
|
||||
|
||||
|
||||
|
||||
[v0.10.5][v0.10.5] (2024-08-24) {#v0.10.5}
|
||||
------------------------------------------
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace Elwig {
|
||||
public static Dispatcher MainDispatcher { get; private set; }
|
||||
private DateTime LastChanged;
|
||||
private static DateTime CurrentLastWrite => File.GetLastWriteTime(Config.DatabaseFile);
|
||||
private readonly DispatcherTimer ContextTimer = new() { Interval = TimeSpan.FromSeconds(2) };
|
||||
private readonly DispatcherTimer ContextTimer = new() { Interval = TimeSpan.FromSeconds(5) };
|
||||
|
||||
public App() : base() {
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
@ -70,8 +70,9 @@ namespace Elwig {
|
||||
}
|
||||
|
||||
ContextTimer.Tick += (object? sender, EventArgs evt) => {
|
||||
if (CurrentLastWrite > LastChanged) {
|
||||
LastChanged = CurrentLastWrite;
|
||||
var ch = CurrentLastWrite;
|
||||
if (ch > LastChanged) {
|
||||
LastChanged = ch;
|
||||
OnContextChanged();
|
||||
}
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
||||
<Version>0.10.5</Version>
|
||||
<Version>0.10.6</Version>
|
||||
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
|
@ -40,12 +40,12 @@ namespace Elwig.Models.Dtos {
|
||||
COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '') AS name_2,
|
||||
p.plz, o.name AS ort, m.address,
|
||||
c.bucket, c.area, u.min_kg, u.weight
|
||||
FROM member m
|
||||
FROM v_area_commitment_bucket_strict c
|
||||
LEFT JOIN member m ON m.mgnr = c.mgnr
|
||||
LEFT JOIN AT_plz_dest p ON p.id = m.postal_dest
|
||||
LEFT JOIN AT_ort o ON o.okz = p.okz
|
||||
LEFT JOIN v_area_commitment_bucket_strict c ON c.mgnr = m.mgnr AND c.year = {year}
|
||||
JOIN v_under_delivery u ON (u.mgnr, u.bucket, u.year) = (m.mgnr, c.bucket, c.year)
|
||||
WHERE m.active = 1
|
||||
WHERE c.year = {year} AND m.active = 1
|
||||
ORDER BY m.mgnr, c.bucket
|
||||
""").ToListAsync();
|
||||
}
|
||||
|
@ -33,12 +33,12 @@ namespace Elwig.Models.Dtos {
|
||||
m.business_shares * s.min_kg_per_bs AS min_kg,
|
||||
m.business_shares * s.max_kg_per_bs AS max_kg,
|
||||
COALESCE(SUM(d.weight), 0) AS sum
|
||||
FROM member m
|
||||
FROM v_delivery d
|
||||
LEFT JOIN member m ON m.mgnr = d.mgnr
|
||||
LEFT JOIN AT_plz_dest p ON p.id = m.postal_dest
|
||||
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 = TRUE OR d.weight > 0
|
||||
LEFT JOIN season s ON s.year = d.year
|
||||
WHERE s.year = {year} AND (m.active = TRUE OR d.weight > 0)
|
||||
GROUP BY d.year, m.mgnr
|
||||
ORDER BY 100.0 * sum / max_kg, m.mgnr;
|
||||
""").ToListAsync();
|
||||
|
@ -133,7 +133,7 @@ namespace Elwig.Windows {
|
||||
return;
|
||||
}
|
||||
ViewModel.FilterMember = m;
|
||||
ViewModel.Title = $"Lieferungen - {ViewModel.FilterMember.AdministrativeName} - Elwig";
|
||||
ViewModel.Title = $"Flächenbindungen - {ViewModel.FilterMember.AdministrativeName} - Elwig";
|
||||
|
||||
ControlUtils.RenewItemsSource(KgInput, await ctx.WbKgs
|
||||
.Include(k => k.AtKg.WbKg!.Rds)
|
||||
|
@ -132,18 +132,20 @@
|
||||
<GroupBox Header="Datenpunkt" Grid.Row="0" Margin="0,5,5,5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="85"/>
|
||||
<ColumnDefinition Width="65"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Content="Oechsle:" Margin="10,10,0,0" Grid.Column="0"/>
|
||||
<ctrl:UnitTextBox x:Name="OechsleInput" Unit="°Oe" TextChanged="OechsleInput_TextChanged" IsEnabled="False" LostFocus="OechsleInput_LostFocus"
|
||||
Grid.Column="1" Width="90" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
|
||||
<ctrl:UnitTextBox x:Name="OechsleInput" Unit="°Oe" TextChanged="OechsleInput_TextChanged" IsEnabled="False"
|
||||
Grid.Column="1" Width="52" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<CheckBox x:Name="GebInput" Content="Geb." IsEnabled="False"
|
||||
Grid.Column="1" Margin="0,15,10,0" HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||
Checked="GebInput_Changed" Unchecked="GebInput_Changed"/>
|
||||
|
||||
<Label Content="Preis:" Margin="10,40,0,0" Grid.Column="0"/>
|
||||
<ctrl:UnitTextBox x:Name="PriceInput" Unit="€/kg" TextChanged="PriceInput_TextChanged" IsEnabled="False" LostFocus="PriceInput_LostFocus"
|
||||
Grid.Column="1" Width="90" Margin="0,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
<ctrl:UnitTextBox x:Name="PriceInput" Unit="€/kg" TextChanged="PriceInput_TextChanged" IsEnabled="False"
|
||||
Grid.Column="1" Margin="0,40,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
|
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Elwig.Controls;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Helpers.Billing;
|
||||
using Elwig.Models.Entities;
|
||||
@ -22,8 +21,10 @@ namespace Elwig.Windows {
|
||||
public readonly int Year;
|
||||
public readonly int AvNr;
|
||||
public Season Season;
|
||||
public string CurrencySymbol;
|
||||
private PaymentVar PaymentVar;
|
||||
private bool HasChanged = false;
|
||||
private bool Updating = false;
|
||||
|
||||
private Scatter DataPlot;
|
||||
private Scatter? GebundenPlot;
|
||||
@ -72,6 +73,9 @@ namespace Elwig.Windows {
|
||||
AvNr = avnr;
|
||||
using var ctx = new AppDbContext();
|
||||
Season = ctx.Seasons.Find(year) ?? throw new ArgumentException("Season not found");
|
||||
CurrencySymbol = Season.Currency.Symbol ?? Season.Currency.Code;
|
||||
PriceInput.Unit = $"{CurrencySymbol}/kg";
|
||||
GebundenFlatBonus.Unit = $"{CurrencySymbol}/kg";
|
||||
PaymentVar = ctx.PaymentVariants.Find(year, avnr) ?? throw new ArgumentException("PaymentVar not found");
|
||||
Title = $"{PaymentVar?.Name} - Lese {year} - Elwig";
|
||||
LockContext = true;
|
||||
@ -99,6 +103,9 @@ namespace Elwig.Windows {
|
||||
private async Task RefreshGraphList(AppDbContext ctx) {
|
||||
PaymentVar = await ctx.PaymentVariants.FindAsync(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found");
|
||||
Season = await ctx.Seasons.FindAsync(Year) ?? throw new ArgumentException("Season not found");
|
||||
CurrencySymbol = Season.Currency.Symbol ?? Season.Currency.Code;
|
||||
PriceInput.Unit = $"{CurrencySymbol}/kg";
|
||||
GebundenFlatBonus.Unit = $"{CurrencySymbol}/kg";
|
||||
|
||||
try {
|
||||
var data = EditBillingData.FromJson(PaymentVar.Data, Utils.GetVaributes(ctx, Year));
|
||||
@ -146,6 +153,8 @@ namespace Elwig.Windows {
|
||||
if (SelectedGraphEntry != null) {
|
||||
CopyButton.IsEnabled = true;
|
||||
DeleteButton.IsEnabled = true;
|
||||
EnableTextBox(OechsleInput);
|
||||
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
|
||||
GebundenTypeFixed.IsEnabled = true;
|
||||
GebundenTypeGraph.IsEnabled = true;
|
||||
GebundenTypeNone.IsEnabled = true;
|
||||
@ -156,15 +165,15 @@ namespace Elwig.Windows {
|
||||
} else {
|
||||
CopyButton.IsEnabled = false;
|
||||
DeleteButton.IsEnabled = false;
|
||||
DisableUnitTextBox(OechsleInput);
|
||||
DisableTextBox(OechsleInput);
|
||||
GebInput.IsEnabled = false;
|
||||
DisableOptionButtons();
|
||||
}
|
||||
if (!PaymentVar.TestVariant) {
|
||||
AddButton.IsEnabled = false;
|
||||
CopyButton.IsEnabled = false;
|
||||
DeleteButton.IsEnabled = false;
|
||||
DisableUnitTextBox(OechsleInput);
|
||||
DisableUnitTextBox(PriceInput);
|
||||
DisableTextBox(PriceInput);
|
||||
GebundenTypeFixed.IsEnabled = false;
|
||||
GebundenTypeGraph.IsEnabled = false;
|
||||
GebundenTypeNone.IsEnabled = false;
|
||||
@ -388,26 +397,23 @@ namespace Elwig.Windows {
|
||||
OechslePricePlot.Plot.Legend.ManualItems.Clear();
|
||||
}
|
||||
|
||||
private void OechsleInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
if (ActiveGraph == null || SelectedGraphEntry == null) {
|
||||
private void UpdateSelectedPoint() {
|
||||
if (ActiveGraph == null || SelectedGraphEntry == null)
|
||||
return;
|
||||
}
|
||||
|
||||
bool success = int.TryParse(OechsleInput.Text, out int oechsle);
|
||||
|
||||
SecondaryMarkedPoint = -1;
|
||||
ChangeMarker(SecondaryMarkedPointPlot, false);
|
||||
|
||||
if (success) {
|
||||
if (oechsle >= ActiveGraph.MinX && oechsle <= ActiveGraph.MaxX) {
|
||||
PrimaryMarkedPoint = oechsle - ActiveGraph.MinX;
|
||||
if (int.TryParse(OechsleInput.Text, out int oe)) {
|
||||
if (oe >= ActiveGraph.MinX && oe <= ActiveGraph.MaxX) {
|
||||
PrimaryMarkedPoint = oe - ActiveGraph.MinX;
|
||||
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
|
||||
|
||||
PriceInput.Text = Math.Round(ActiveGraph.GetPriceAt(PrimaryMarkedPoint), Season.Precision).ToString();
|
||||
|
||||
EnableActionButtons();
|
||||
OechslePricePlot.Refresh();
|
||||
EnableUnitTextBox(PriceInput);
|
||||
EnableTextBox(PriceInput);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -416,9 +422,21 @@ namespace Elwig.Windows {
|
||||
ChangeMarker(PrimaryMarkedPointPlot, false);
|
||||
DisableActionButtons();
|
||||
PriceInput.Text = "";
|
||||
DisableUnitTextBox(PriceInput);
|
||||
DisableTextBox(PriceInput);
|
||||
OechslePricePlot.Refresh();
|
||||
DisableUnitTextBox(PriceInput);
|
||||
DisableTextBox(PriceInput);
|
||||
}
|
||||
|
||||
private void OechsleInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
UpdateSelectedPoint();
|
||||
}
|
||||
|
||||
private void GebInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
if (Updating)
|
||||
return;
|
||||
var sel = GebInput.IsChecked == true ? SelectedGraphEntry?.GebundenGraph : SelectedGraphEntry?.DataGraph;
|
||||
if (sel != ActiveGraph) ChangeActiveGraph(sel);
|
||||
UpdateSelectedPoint();
|
||||
}
|
||||
|
||||
private void PriceInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
@ -479,31 +497,34 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void OechslePricePlot_MouseDown(object sender, MouseEventArgs e) {
|
||||
if (GraphList.SelectedItem == null) {
|
||||
if (GraphList.SelectedItem == null)
|
||||
return;
|
||||
}
|
||||
|
||||
if (HoverActive) {
|
||||
if (PaymentVar.TestVariant && Keyboard.IsKeyDown(System.Windows.Input.Key.LeftCtrl)) {
|
||||
if (PrimaryMarkedPoint == -1 || ActiveGraph == null || ActiveGraph != Highlighted.Graph) {
|
||||
if (SecondaryMarkedPoint == -1 || ActiveGraph == null || ActiveGraph != Highlighted.Graph)
|
||||
return;
|
||||
}
|
||||
SecondaryMarkedPoint = Highlighted.Index;
|
||||
|
||||
ChangeMarker(SecondaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(SecondaryMarkedPoint), ActiveGraph.GetPriceAt(SecondaryMarkedPoint));
|
||||
|
||||
InterpolateButton.IsEnabled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Updating = true;
|
||||
PrimaryMarkedPoint = Highlighted.Index;
|
||||
if (ActiveGraph != Highlighted.Graph) ChangeActiveGraph(Highlighted.Graph);
|
||||
if (ActiveGraph != Highlighted.Graph)
|
||||
ChangeActiveGraph(Highlighted.Graph);
|
||||
Updating = false;
|
||||
if (PrimaryMarkedPoint == -1 || ActiveGraph == null)
|
||||
return;
|
||||
|
||||
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph!.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
|
||||
ChangeMarker(PrimaryMarkedPointPlot, true, ActiveGraph.GetOechsleAt(PrimaryMarkedPoint), ActiveGraph.GetPriceAt(PrimaryMarkedPoint));
|
||||
|
||||
Updating = true;
|
||||
OechsleInput.Text = Highlighted.Graph!.GetOechsleAt(Highlighted.Index).ToString();
|
||||
GebInput.IsChecked = Highlighted.Graph == SelectedGraphEntry?.GebundenGraph;
|
||||
PriceInput.Text = Math.Round(Highlighted.Graph.GetPriceAt(Highlighted.Index), Season.Precision).ToString();
|
||||
Updating = false;
|
||||
|
||||
EnableActionButtons();
|
||||
} else {
|
||||
@ -516,8 +537,9 @@ namespace Elwig.Windows {
|
||||
ChangeMarker(SecondaryMarkedPointPlot, false);
|
||||
|
||||
OechsleInput.Text = "";
|
||||
GebInput.IsChecked = false;
|
||||
PriceInput.Text = "";
|
||||
DisableUnitTextBox(PriceInput);
|
||||
DisableTextBox(PriceInput);
|
||||
|
||||
DisableActionButtons();
|
||||
}
|
||||
@ -531,28 +553,39 @@ namespace Elwig.Windows {
|
||||
MouseChange(e);
|
||||
}
|
||||
|
||||
private Coordinates GetMouseCoordinates(Point p) {
|
||||
Pixel px = new(p.X, p.Y);
|
||||
var source = PresentationSource.FromVisual(this);
|
||||
if (source?.CompositionTarget != null) {
|
||||
var matrix = source.CompositionTarget.TransformToDevice;
|
||||
px.X *= (float)matrix.M11;
|
||||
px.Y *= (float)matrix.M22;
|
||||
}
|
||||
return OechslePricePlot.Plot.GetCoordinates(px);
|
||||
}
|
||||
|
||||
private void MouseChange(MouseEventArgs e) {
|
||||
if (GraphList.SelectedItem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
(double x, double y, int index)? mouseOnData = MouseOnPlot(DataPlot, e.GetPosition(OechslePricePlot));
|
||||
(double x, double y, int index)? mouseOnGebunden = MouseOnPlot(GebundenPlot, e.GetPosition(OechslePricePlot));
|
||||
var mouseOnData = MouseOnPlot(DataPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
|
||||
var mouseOnGebunden = MouseOnPlot(GebundenPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
|
||||
|
||||
Highlighted = LastHighlighted;
|
||||
|
||||
if (mouseOnData != null) {
|
||||
ChangeMarker(HighlightedPointPlot, true, mouseOnData.Value.x, mouseOnData.Value.y);
|
||||
ChangeMarker(HighlightedPointPlot, true, mouseOnData.Value.X, mouseOnData.Value.Y);
|
||||
HighlightedPointPlot.IsVisible = true;
|
||||
HoverChanged = true ^ HoverActive;
|
||||
HoverActive = true;
|
||||
HandleTooltip(mouseOnData.Value.x, mouseOnData.Value.y, mouseOnData.Value.index, SelectedGraphEntry!.DataGraph, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
|
||||
HandleTooltip(mouseOnData.Value.X, mouseOnData.Value.Y, mouseOnData.Value.Index, SelectedGraphEntry!.DataGraph, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
|
||||
} else if (mouseOnGebunden != null) {
|
||||
ChangeMarker(HighlightedPointPlot, true, mouseOnGebunden.Value.x, mouseOnGebunden.Value.y);
|
||||
ChangeMarker(HighlightedPointPlot, true, mouseOnGebunden.Value.X, mouseOnGebunden.Value.Y);
|
||||
HighlightedPointPlot.IsVisible = true;
|
||||
HoverChanged = true ^ HoverActive;
|
||||
HoverActive = true;
|
||||
HandleTooltip(mouseOnGebunden.Value.x, mouseOnGebunden.Value.y, mouseOnGebunden.Value.index, SelectedGraphEntry!.GebundenGraph!, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
|
||||
HandleTooltip(mouseOnGebunden.Value.X, mouseOnGebunden.Value.Y, mouseOnGebunden.Value.Index, SelectedGraphEntry!.GebundenGraph!, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
|
||||
} else {
|
||||
ChangeMarker(HighlightedPointPlot, false);
|
||||
HoverChanged = false ^ HoverActive;
|
||||
@ -562,30 +595,20 @@ namespace Elwig.Windows {
|
||||
}
|
||||
}
|
||||
|
||||
private (double, double, int)? MouseOnPlot(Scatter? plot, Point p) {
|
||||
if (plot == null) {
|
||||
private (double X, double Y, int Index)? MouseOnPlot(Scatter? plot, Coordinates c) {
|
||||
if (plot == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
OechslePricePlot.Refresh();
|
||||
Pixel mousePixel = new(p.X, p.Y);
|
||||
Coordinates mouseLocation = OechslePricePlot.Plot.GetCoordinates(mousePixel);
|
||||
DataPoint nearestPoint = plot.Data.GetNearest(mouseLocation, OechslePricePlot.Plot.LastRender, 3);
|
||||
|
||||
if (nearestPoint.IsReal) {
|
||||
return (nearestPoint.X, nearestPoint.Y, nearestPoint.Index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
DataPoint nearestPoint = plot.Data.GetNearest(c, OechslePricePlot.Plot.LastRender, 5);
|
||||
return nearestPoint.IsReal ? (nearestPoint.X, nearestPoint.Y, nearestPoint.Index) : null;
|
||||
}
|
||||
|
||||
private void HandleTooltip(double pointX, double pointY, int pointIndex, Graph g, Point p, bool force) {
|
||||
if (force || LastHighlighted != Highlighted || HoverChanged) {
|
||||
OechslePricePlot.Plot.PlottableList.Remove(TooltipPlot);
|
||||
if (TooltipInput.IsChecked == true) {
|
||||
Pixel mousePixel = new(p.X, p.Y - 30);
|
||||
Coordinates mouseLocation = OechslePricePlot.Plot.GetCoordinates(mousePixel);
|
||||
TooltipPlot = OechslePricePlot.Plot.Add.Text($"Oechsle: {pointX:N2}, Preis: {Math.Round(pointY, Season.Precision)}€/kg", mouseLocation.X, mouseLocation.Y);
|
||||
Coordinates mouseLocation = GetMouseCoordinates(new(p.X, p.Y - 30));
|
||||
TooltipPlot = OechslePricePlot.Plot.Add.Text($"Oechsle: {pointX:N2}, Preis: {Math.Round(pointY, Season.Precision)} {CurrencySymbol}/kg", mouseLocation.X, mouseLocation.Y);
|
||||
TooltipPlot.LabelFontSize = 12;
|
||||
TooltipPlot.LabelBold = true;
|
||||
TooltipPlot.LabelBorderColor = Colors.Black;
|
||||
@ -658,31 +681,37 @@ namespace Elwig.Windows {
|
||||
SetHasChanged(false);
|
||||
}
|
||||
|
||||
private void EnableUnitTextBox(UnitTextBox u) {
|
||||
if (PaymentVar.TestVariant) {
|
||||
private void EnableTextBox(TextBox u) {
|
||||
if (PaymentVar.TestVariant || u == OechsleInput) {
|
||||
u.IsEnabled = true;
|
||||
u.IsReadOnly = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableUnitTextBox(UnitTextBox u) {
|
||||
private void DisableTextBox(TextBox u) {
|
||||
u.IsEnabled = false;
|
||||
u.IsReadOnly = true;
|
||||
}
|
||||
|
||||
private void ChangeActiveGraph(Graph? g) {
|
||||
if (g != null && g == SelectedGraphEntry?.DataGraph) {
|
||||
EnableUnitTextBox(OechsleInput);
|
||||
EnableTextBox(OechsleInput);
|
||||
if (SelectedGraphEntry?.GebundenGraph != null) ChangeLineWidth(DataPlot, 4);
|
||||
ChangeLineWidth(GebundenPlot, 1);
|
||||
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
|
||||
GebInput.IsChecked = false;
|
||||
} else if (g != null && g == SelectedGraphEntry?.GebundenGraph) {
|
||||
EnableUnitTextBox(OechsleInput);
|
||||
EnableTextBox(OechsleInput);
|
||||
ChangeLineWidth(GebundenPlot, 4);
|
||||
ChangeLineWidth(DataPlot, 1);
|
||||
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
|
||||
GebInput.IsChecked = true;
|
||||
} else {
|
||||
DisableUnitTextBox(OechsleInput);
|
||||
DisableUnitTextBox(PriceInput);
|
||||
DisableTextBox(OechsleInput);
|
||||
DisableTextBox(PriceInput);
|
||||
OechsleInput.Text = "";
|
||||
GebInput.IsEnabled = false;
|
||||
GebInput.IsChecked = false;
|
||||
PriceInput.Text = "";
|
||||
ChangeLineWidth(DataPlot, 1);
|
||||
ChangeLineWidth(GebundenPlot, 1);
|
||||
@ -700,14 +729,6 @@ namespace Elwig.Windows {
|
||||
RefreshInputs();
|
||||
}
|
||||
|
||||
private void PriceInput_LostFocus(object sender, RoutedEventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void OechsleInput_LostFocus(object sender, RoutedEventArgs e) {
|
||||
|
||||
}
|
||||
|
||||
private void GebundenFlatBonus_TextChanged(object sender, TextChangedEventArgs e) {
|
||||
if (FillingInputs) return;
|
||||
var r = Validator.CheckDecimal(GebundenFlatBonus, true, 2, Season.Precision);
|
||||
@ -778,19 +799,19 @@ namespace Elwig.Windows {
|
||||
private void GebundenType_Checked(object sender, RoutedEventArgs e) {
|
||||
if (FillingInputs) return;
|
||||
if (SelectedGraphEntry == null) {
|
||||
DisableUnitTextBox(GebundenFlatBonus);
|
||||
DisableTextBox(GebundenFlatBonus);
|
||||
return;
|
||||
}
|
||||
if (GebundenTypeNone.IsChecked == true) {
|
||||
SelectedGraphEntry.RemoveGebundenGraph();
|
||||
DisableUnitTextBox(GebundenFlatBonus);
|
||||
DisableTextBox(GebundenFlatBonus);
|
||||
} else if (GebundenTypeFixed.IsChecked == true) {
|
||||
SelectedGraphEntry.GebundenFlatBonus = double.TryParse(GebundenFlatBonus.Text, out var val) ? val : 0.1;
|
||||
SelectedGraphEntry.AddGebundenGraph();
|
||||
EnableUnitTextBox(GebundenFlatBonus);
|
||||
EnableTextBox(GebundenFlatBonus);
|
||||
} else if (GebundenTypeGraph.IsChecked == true) {
|
||||
SelectedGraphEntry.AddGebundenGraph();
|
||||
DisableUnitTextBox(GebundenFlatBonus);
|
||||
DisableTextBox(GebundenFlatBonus);
|
||||
}
|
||||
SetHasChanged();
|
||||
RefreshInputs();
|
||||
@ -801,11 +822,11 @@ namespace Elwig.Windows {
|
||||
if (SelectedGraphEntry?.GebundenFlatBonus is double bonus) {
|
||||
GebundenTypeFixed.IsChecked = true;
|
||||
GebundenFlatBonus.Text = $"{bonus}";
|
||||
EnableUnitTextBox(GebundenFlatBonus);
|
||||
EnableTextBox(GebundenFlatBonus);
|
||||
} else if (SelectedGraphEntry?.GebundenGraph != null) {
|
||||
GebundenTypeGraph.IsChecked = true;
|
||||
GebundenFlatBonus.Text = "";
|
||||
DisableUnitTextBox(GebundenFlatBonus);
|
||||
DisableTextBox(GebundenFlatBonus);
|
||||
}
|
||||
FillingInputs = false;
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ namespace Elwig.Windows {
|
||||
private async void NewDeliveryPartButton_Click(object sender, RoutedEventArgs evt) {
|
||||
FinishButton.IsEnabled = false;
|
||||
NewDeliveryPartButton.IsEnabled = false;
|
||||
NewDeliveryPartButton.Cursor = Cursors.Wait;
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
DeliveryPartList.IsEnabled = false;
|
||||
var p = await ViewModel.UpdateDeliveryPart(
|
||||
(DeliveryList.SelectedItem as Delivery)?.Year,
|
||||
@ -703,9 +703,10 @@ namespace Elwig.Windows {
|
||||
EmptyScale();
|
||||
await RefreshList();
|
||||
await RefreshDeliveryParts();
|
||||
NewDeliveryPartButton.Cursor = null;
|
||||
Mouse.OverrideCursor = null;
|
||||
ControlUtils.SelectItem(DeliveryList, p?.Delivery);
|
||||
DeliveryPartList.SelectedItem = null;
|
||||
DeliveryPartList.ScrollIntoView(DeliveryPartList.ItemsSource.Cast<object>().Last());
|
||||
RefreshInputs();
|
||||
InitialInputs();
|
||||
}
|
||||
@ -713,7 +714,7 @@ namespace Elwig.Windows {
|
||||
private async void FinishButton_Click(object sender, RoutedEventArgs evt) {
|
||||
FinishButton.IsEnabled = false;
|
||||
NewDeliveryPartButton.IsEnabled = false;
|
||||
FinishButton.Cursor = Cursors.Wait;
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
DeliveryPartList.IsEnabled = false;
|
||||
var p = await ViewModel.UpdateDeliveryPart(
|
||||
(DeliveryList.SelectedItem as Delivery)?.Year,
|
||||
@ -727,7 +728,6 @@ namespace Elwig.Windows {
|
||||
await RefreshList();
|
||||
await RefreshDeliveryParts();
|
||||
if (p?.Delivery != null) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
try {
|
||||
using var ctx = new AppDbContext();
|
||||
using var doc = new DeliveryNote((await ctx.Deliveries.FindAsync(p.Year, p.DId))!, ctx);
|
||||
@ -740,9 +740,8 @@ namespace Elwig.Windows {
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
FinishButton.Cursor = null;
|
||||
Mouse.OverrideCursor = null;
|
||||
DeliveryList.SelectedItem = null;
|
||||
await RenewContext();
|
||||
RefreshInputs();
|
||||
@ -937,7 +936,7 @@ namespace Elwig.Windows {
|
||||
|
||||
private async void SaveButton_Click(object? sender, RoutedEventArgs? evt) {
|
||||
SaveButton.IsEnabled = false;
|
||||
SaveButton.Cursor = Cursors.Wait;
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
|
||||
IsEditing = false;
|
||||
IsCreating = false;
|
||||
@ -953,7 +952,7 @@ namespace Elwig.Windows {
|
||||
!InputIsNotDefault(TimeInput)
|
||||
);
|
||||
|
||||
SaveButton.Cursor = null;
|
||||
Mouse.OverrideCursor = null;
|
||||
|
||||
HideSaveResetCancelButtons();
|
||||
ShowNewEditDeleteButtons();
|
||||
|
@ -8,7 +8,7 @@
|
||||
xmlns:local="clr-namespace:Elwig.Windows"
|
||||
xmlns:vm="clr-namespace:Elwig.ViewModels"
|
||||
xmlns:ctrl="clr-namespace:Elwig.Controls"
|
||||
Title="Traubenanmeldungen - Elwig" Height="700" Width="900" MinWidth="600" MinHeight="400"
|
||||
Title="Traubenanmeldungen - Elwig" Height="700" Width="940" MinWidth="600" MinHeight="400"
|
||||
Loaded="Window_Loaded">
|
||||
<Window.DataContext>
|
||||
<vm:DeliveryAncmtAdminViewModel/>
|
||||
|
@ -53,7 +53,7 @@ namespace Elwig.Windows {
|
||||
WeightInput.Focus();
|
||||
WeightInput.SelectAll();
|
||||
} else if (ctrl == WeightInput) {
|
||||
SaveButton_Click(null, null);
|
||||
ShortcutSave();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
<MenuItem Header="Abfragen stellen" Click="Menu_Database_Query_Click"/>
|
||||
<MenuItem Header="Speicherort öffnen..." Click="Menu_Database_Open_Click"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Waagen">
|
||||
<MenuItem Header="Datum und Uhrzeit setzen" Click="Menu_Scales_SetDateTime_Click"/>
|
||||
<MenuItem Header="Waage">
|
||||
<MenuItem Header="Datum und Uhrzeit setzen" Click="Menu_Scale_SetDateTime_Click"/>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="HelpMenu" Header="Hilfe">
|
||||
<MenuItem Header="Über"/>
|
||||
|
@ -90,7 +90,7 @@ namespace Elwig.Windows {
|
||||
} catch { }
|
||||
}
|
||||
|
||||
private async void Menu_Scales_SetDateTime_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void Menu_Scale_SetDateTime_Click(object sender, RoutedEventArgs evt) {
|
||||
if (App.CommandScales.Count == 0) {
|
||||
MessageBox.Show("Es sind keine geeigneten Waagen verfügbar!", "Datum und Uhrzeit setzen", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
|
@ -769,6 +769,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private void ContactEmailInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
CheckBox_Changed(sender, evt);
|
||||
EmailAddressInput_TextChanged(EmailAddress1Input, new TextChangedEventArgs(evt.RoutedEvent, UndoAction.None));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user