Elwig: Rename buchführend, funktionär, volllieferant, and gebunden

This commit is contained in:
2026-09-30 12:14:25 +02:00
parent 4988081bfd
commit 5f2788eb9e
40 changed files with 393 additions and 355 deletions
+91 -91
View File
@@ -15,8 +15,8 @@ using Elwig.Services;
namespace Elwig.Windows {
public partial class ChartWindow : ContextWindow {
public static readonly Color ColorUngebunden = Colors.Blue;
public static readonly Color ColorGebunden = Colors.Gold;
public static readonly Color ColorUnContracted = Colors.Blue;
public static readonly Color ColorContracted = Colors.Gold;
public readonly int Year;
public readonly int AvNr;
@@ -27,20 +27,20 @@ namespace Elwig.Windows {
private bool Updating = false;
private Scatter? DataPlot;
private Scatter? GebundenPlot;
private Scatter? ContractedPlot;
private Marker? HighlightedPointPlot;
private Marker? PrimaryMarkedPointPlot;
private Marker? SecondaryMarkedPointPlot;
private Text? TooltipPlot;
private static readonly LegendItem
UngebundenLegend = new() {
LabelText = "Ungebunden", LineWidth = 1, LineColor = ColorUngebunden,
MarkerStyle = new(MarkerShape.FilledCircle, 5, ColorUngebunden)
UnContractedLegend = new() {
LabelText = "Ungebunden", LineWidth = 1, LineColor = ColorUnContracted,
MarkerStyle = new(MarkerShape.FilledCircle, 5, ColorUnContracted)
},
GebundenLegend = new() {
LabelText = "Gebunden", LineWidth = 1, LineColor = ColorGebunden,
MarkerStyle = new(MarkerShape.FilledCircle, 5, ColorGebunden)
ContractedLegend = new() {
LabelText = "Gebunden", LineWidth = 1, LineColor = ColorContracted,
MarkerStyle = new(MarkerShape.FilledCircle, 5, ColorContracted)
},
LdwLegend = new() {
LabelText = "68 °Oe (LDW)", LineWidth = 2, LineColor = Colors.Red, MarkerStyle = MarkerStyle.None
@@ -75,7 +75,7 @@ namespace Elwig.Windows {
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";
ContractedFlatBonus.Unit = $"{CurrencySymbol}/kg";
PaymentVar = ctx.PaymentVariants.Find(year, avnr) ?? throw new ArgumentException("PaymentVar not found");
Title = $"{PaymentVar.Name} - Lese {year} - Elwig";
LockContext = true;
@@ -100,7 +100,7 @@ namespace Elwig.Windows {
Season = await ctx.FetchSeasons(Year).SingleOrDefaultAsync() ?? throw new ArgumentException("Season not found");
CurrencySymbol = Season.Currency.Symbol ?? Season.Currency.Code;
PriceInput.Unit = $"{CurrencySymbol}/kg";
GebundenFlatBonus.Unit = $"{CurrencySymbol}/kg";
ContractedFlatBonus.Unit = $"{CurrencySymbol}/kg";
try {
var data = EditBillingData.FromJson(PaymentVar.Data, await Utils.GetVaributes(ctx, Year));
@@ -148,10 +148,10 @@ namespace Elwig.Windows {
CopyButton.IsEnabled = true;
DeleteButton.IsEnabled = true;
EnableTextBox(OechsleInput);
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
GebundenTypeFixed.IsEnabled = true;
GebundenTypeGraph.IsEnabled = true;
GebundenTypeNone.IsEnabled = true;
ContractedInput.IsEnabled = SelectedGraphEntry?.ContractedGraph != null;
ContractedTypeFixed.IsEnabled = true;
ContractedTypeGraph.IsEnabled = true;
ContractedTypeNone.IsEnabled = true;
VaributeInput.IsEnabled = true;
AbgewertetInput.IsEnabled = true;
EnableOptionButtons();
@@ -160,7 +160,7 @@ namespace Elwig.Windows {
CopyButton.IsEnabled = false;
DeleteButton.IsEnabled = false;
DisableTextBox(OechsleInput);
GebInput.IsEnabled = false;
ContractedInput.IsEnabled = false;
DisableOptionButtons();
}
if (!PaymentVar.TestVariant) {
@@ -168,9 +168,9 @@ namespace Elwig.Windows {
CopyButton.IsEnabled = false;
DeleteButton.IsEnabled = false;
DisableTextBox(PriceInput);
GebundenTypeFixed.IsEnabled = false;
GebundenTypeGraph.IsEnabled = false;
GebundenTypeNone.IsEnabled = false;
ContractedTypeFixed.IsEnabled = false;
ContractedTypeGraph.IsEnabled = false;
ContractedTypeNone.IsEnabled = false;
VaributeInput.IsEnabled = false;
AbgewertetInput.IsEnabled = false;
}
@@ -181,15 +181,15 @@ namespace Elwig.Windows {
FillingInputs = true;
AbgewertetInput.IsChecked = SelectedGraphEntry?.Abgewertet;
if (SelectedGraphEntry?.GebundenFlatBonus is double bonus) {
GebundenTypeFixed.IsChecked = true;
GebundenFlatBonus.Text = $"{bonus}";
} else if (SelectedGraphEntry?.GebundenGraph != null) {
GebundenTypeGraph.IsChecked = true;
GebundenFlatBonus.Text = "";
if (SelectedGraphEntry?.ContractedFlatBonus is double bonus) {
ContractedTypeFixed.IsChecked = true;
ContractedFlatBonus.Text = $"{bonus}";
} else if (SelectedGraphEntry?.ContractedGraph != null) {
ContractedTypeGraph.IsChecked = true;
ContractedFlatBonus.Text = "";
} else {
GebundenTypeNone.IsChecked = true;
GebundenFlatBonus.Text = "";
ContractedTypeNone.IsChecked = true;
ContractedFlatBonus.Text = "";
}
ControlUtils.SelectItems(VaributeInput, SelectedGraphEntry?.Vaributes ?? []);
@@ -208,21 +208,21 @@ namespace Elwig.Windows {
private void InitPlot() {
RefreshGradationLines();
if (SelectedGraphEntry?.GebundenGraph != null) {
GebundenPlot = OechslePricePlot.Plot.Add.Scatter(SelectedGraphEntry.GebundenGraph.DataX, SelectedGraphEntry.GebundenGraph.DataY);
GebundenPlot.LineStyle.Color = ColorGebunden;
GebundenPlot.Color = ColorGebunden;
GebundenPlot.MarkerStyle = new MarkerStyle(MarkerShape.FilledCircle, 9, ColorGebunden);
if (SelectedGraphEntry?.ContractedGraph != null) {
ContractedPlot = OechslePricePlot.Plot.Add.Scatter(SelectedGraphEntry.ContractedGraph.DataX, SelectedGraphEntry.ContractedGraph.DataY);
ContractedPlot.LineStyle.Color = ColorContracted;
ContractedPlot.Color = ColorContracted;
ContractedPlot.MarkerStyle = new MarkerStyle(MarkerShape.FilledCircle, 9, ColorContracted);
}
if (SelectedGraphEntry != null) {
DataPlot = OechslePricePlot.Plot.Add.Scatter(SelectedGraphEntry.DataGraph.DataX, SelectedGraphEntry.DataGraph.DataY);
DataPlot.LineStyle.Color = ColorUngebunden;
DataPlot.Color = ColorUngebunden;
DataPlot.MarkerStyle = new MarkerStyle(MarkerShape.FilledCircle, 9, ColorUngebunden);
DataPlot.LineStyle.Color = ColorUnContracted;
DataPlot.Color = ColorUnContracted;
DataPlot.MarkerStyle = new MarkerStyle(MarkerShape.FilledCircle, 9, ColorUnContracted);
}
OechslePricePlot.Plot.Axes.SetLimits(Math.Min(GraphEntry.MinX, GraphEntry.MinXGeb) - 1, GraphEntry.MaxX + 1, -0.1, 1.5);
OechslePricePlot.Plot.Axes.SetLimits(Math.Min(GraphEntry.MinX, GraphEntry.MinXCtrd) - 1, GraphEntry.MaxX + 1, -0.1, 1.5);
HighlightedPointPlot = OechslePricePlot.Plot.Add.Marker(0, 0, MarkerShape.OpenCircle, 10, Colors.Red);
HighlightedPointPlot.IsVisible = false;
@@ -250,9 +250,9 @@ namespace Elwig.Windows {
OechslePricePlot.Plot.Remove(DataPlot);
DataPlot = null;
}
if (GebundenPlot != null) {
OechslePricePlot.Plot.Remove(GebundenPlot);
GebundenPlot = null;
if (ContractedPlot != null) {
OechslePricePlot.Plot.Remove(ContractedPlot);
ContractedPlot = null;
}
OechslePricePlot.Plot.Clear();
OechslePricePlot.Reset();
@@ -365,8 +365,8 @@ namespace Elwig.Windows {
OechslePricePlot.Plot.Legend.ManualItems.Add(LdwLegend);
OechslePricePlot.Plot.Legend.ManualItems.Add(QuwLegend);
OechslePricePlot.Plot.Legend.ManualItems.Add(KabLegend);
OechslePricePlot.Plot.Legend.ManualItems.Add(UngebundenLegend);
if (SelectedGraphEntry?.GebundenGraph != null) OechslePricePlot.Plot.Legend.ManualItems.Add(GebundenLegend);
OechslePricePlot.Plot.Legend.ManualItems.Add(UnContractedLegend);
if (SelectedGraphEntry?.ContractedGraph != null) OechslePricePlot.Plot.Legend.ManualItems.Add(ContractedLegend);
}
private void HideLegend() {
@@ -408,10 +408,10 @@ namespace Elwig.Windows {
UpdateSelectedPoint();
}
private void GebInput_Changed(object sender, RoutedEventArgs evt) {
private void ContractedInput_Changed(object sender, RoutedEventArgs evt) {
if (Updating)
return;
var sel = GebInput.IsChecked == true ? SelectedGraphEntry?.GebundenGraph : SelectedGraphEntry?.DataGraph;
var sel = ContractedInput.IsChecked == true ? SelectedGraphEntry?.ContractedGraph : SelectedGraphEntry?.DataGraph;
if (sel != ActiveGraph) ChangeActiveGraph(sel);
UpdateSelectedPoint();
}
@@ -424,7 +424,7 @@ namespace Elwig.Windows {
PrimaryMarkedPointPlot?.Location = new Coordinates(PrimaryMarkedPointPlot.Location.X, price);
SetHasChanged();
OechslePricePlot.Refresh();
CheckGebundenTypeFixed();
CheckContractedTypeFixed();
}
}
}
@@ -436,7 +436,7 @@ namespace Elwig.Windows {
ActiveGraph.FlattenGraphLeft(PrimaryMarkedPoint);
SetHasChanged();
OechslePricePlot.Refresh();
CheckGebundenTypeFixed();
CheckContractedTypeFixed();
}
private void RightFlatButton_Click(object sender, RoutedEventArgs evt) {
@@ -446,7 +446,7 @@ namespace Elwig.Windows {
ActiveGraph.FlattenGraphRight(PrimaryMarkedPoint);
SetHasChanged();
OechslePricePlot.Refresh();
CheckGebundenTypeFixed();
CheckContractedTypeFixed();
}
private void InterpolateButton_Click(object sender, RoutedEventArgs evt) {
@@ -456,7 +456,7 @@ namespace Elwig.Windows {
ActiveGraph.InterpolateGraph(PrimaryMarkedPoint, SecondaryMarkedPoint);
SetHasChanged();
OechslePricePlot.Refresh();
CheckGebundenTypeFixed();
CheckContractedTypeFixed();
}
private void LinearIncreaseButton_Click(object sender, RoutedEventArgs e) {
@@ -470,7 +470,7 @@ namespace Elwig.Windows {
ActiveGraph.LinearIncreaseGraphToEnd(PrimaryMarkedPoint, priceIncrease.Value);
SetHasChanged();
OechslePricePlot.Refresh();
CheckGebundenTypeFixed();
CheckContractedTypeFixed();
}
private void OechslePricePlot_MouseDown(object sender, MouseEventArgs e) {
@@ -500,7 +500,7 @@ namespace Elwig.Windows {
if (Highlighted.Graph != null) {
Updating = true;
OechsleInput.Text = Highlighted.Graph.GetOechsleAt(Highlighted.Index).ToString();
GebInput.IsChecked = Highlighted.Graph == SelectedGraphEntry?.GebundenGraph;
ContractedInput.IsChecked = Highlighted.Graph == SelectedGraphEntry?.ContractedGraph;
PriceInput.Text = Math.Round(Highlighted.Graph.GetPriceAt(Highlighted.Index), Season.Precision).ToString();
Updating = false;
}
@@ -509,14 +509,14 @@ namespace Elwig.Windows {
} else {
PrimaryMarkedPoint = -1;
SecondaryMarkedPoint = -1;
if (SelectedGraphEntry?.GebundenGraph != null) {
if (SelectedGraphEntry?.ContractedGraph != null) {
ChangeActiveGraph(null);
}
ChangeMarker(PrimaryMarkedPointPlot, false);
ChangeMarker(SecondaryMarkedPointPlot, false);
OechsleInput.Text = "";
GebInput.IsChecked = false;
ContractedInput.IsChecked = false;
PriceInput.Text = "";
DisableTextBox(PriceInput);
@@ -549,7 +549,7 @@ namespace Elwig.Windows {
}
var mouseOnData = MouseOnPlot(DataPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
var mouseOnGebunden = MouseOnPlot(GebundenPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
var mouseOnContracted = MouseOnPlot(ContractedPlot, GetMouseCoordinates(e.GetPosition(OechslePricePlot)));
Highlighted = LastHighlighted;
@@ -560,13 +560,13 @@ namespace Elwig.Windows {
HoverActive = true;
if (SelectedGraphEntry?.DataGraph is Graph g)
HandleTooltip(mouseOnData.Value.X, mouseOnData.Value.Y, mouseOnData.Value.Index, g, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
} else if (mouseOnGebunden != null) {
ChangeMarker(HighlightedPointPlot, true, mouseOnGebunden.Value.X, mouseOnGebunden.Value.Y);
} else if (mouseOnContracted != null) {
ChangeMarker(HighlightedPointPlot, true, mouseOnContracted.Value.X, mouseOnContracted.Value.Y);
HighlightedPointPlot?.IsVisible = true;
HoverChanged = true ^ HoverActive;
HoverActive = true;
if (SelectedGraphEntry?.GebundenGraph is Graph g)
HandleTooltip(mouseOnGebunden.Value.X, mouseOnGebunden.Value.Y, mouseOnGebunden.Value.Index, g, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
if (SelectedGraphEntry?.ContractedGraph is Graph g)
HandleTooltip(mouseOnContracted.Value.X, mouseOnContracted.Value.Y, mouseOnContracted.Value.Index, g, e.GetPosition(OechslePricePlot), e is MouseWheelEventArgs);
} else {
ChangeMarker(HighlightedPointPlot, false);
HoverChanged = false ^ HoverActive;
@@ -699,25 +699,25 @@ namespace Elwig.Windows {
private void ChangeActiveGraph(Graph? g) {
if (g != null && g == SelectedGraphEntry?.DataGraph) {
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) {
if (SelectedGraphEntry?.ContractedGraph != null) ChangeLineWidth(DataPlot, 4);
ChangeLineWidth(ContractedPlot, 1);
ContractedInput.IsEnabled = SelectedGraphEntry?.ContractedGraph != null;
ContractedInput.IsChecked = false;
} else if (g != null && g == SelectedGraphEntry?.ContractedGraph) {
EnableTextBox(OechsleInput);
ChangeLineWidth(GebundenPlot, 4);
ChangeLineWidth(ContractedPlot, 4);
ChangeLineWidth(DataPlot, 1);
GebInput.IsEnabled = SelectedGraphEntry?.GebundenGraph != null;
GebInput.IsChecked = true;
ContractedInput.IsEnabled = SelectedGraphEntry?.ContractedGraph != null;
ContractedInput.IsChecked = true;
} else {
DisableTextBox(OechsleInput);
DisableTextBox(PriceInput);
OechsleInput.Text = "";
GebInput.IsEnabled = false;
GebInput.IsChecked = false;
ContractedInput.IsEnabled = false;
ContractedInput.IsChecked = false;
PriceInput.Text = "";
ChangeLineWidth(DataPlot, 1);
ChangeLineWidth(GebundenPlot, 1);
ChangeLineWidth(ContractedPlot, 1);
}
ActiveGraph = g;
}
@@ -730,11 +730,11 @@ namespace Elwig.Windows {
RefreshInputs();
}
private void GebundenFlatBonus_TextChanged(object sender, TextChangedEventArgs e) {
private void ContractedFlatBonus_TextChanged(object sender, TextChangedEventArgs e) {
if (FillingInputs) return;
var r = Validator.CheckDecimal(GebundenFlatBonus, true, 2, Season.Precision);
var r = Validator.CheckDecimal(ContractedFlatBonus, true, 2, Season.Precision);
if (r.IsValid && SelectedGraphEntry != null) {
SelectedGraphEntry.GebundenFlatBonus = double.Parse(GebundenFlatBonus.Text);
SelectedGraphEntry.ContractedFlatBonus = double.Parse(ContractedFlatBonus.Text);
ResetPlot();
InitPlot();
}
@@ -795,37 +795,37 @@ namespace Elwig.Windows {
GraphList.Items.Refresh();
}
private void GebundenType_Checked(object sender, RoutedEventArgs e) {
private void ContractedType_Checked(object sender, RoutedEventArgs e) {
if (FillingInputs) return;
if (SelectedGraphEntry == null) {
DisableTextBox(GebundenFlatBonus);
DisableTextBox(ContractedFlatBonus);
return;
}
if (GebundenTypeNone.IsChecked == true) {
SelectedGraphEntry.RemoveGebundenGraph();
DisableTextBox(GebundenFlatBonus);
} else if (GebundenTypeFixed.IsChecked == true) {
SelectedGraphEntry.GebundenFlatBonus = double.TryParse(GebundenFlatBonus.Text, out var val) ? val : 0.1;
SelectedGraphEntry.AddGebundenGraph();
EnableTextBox(GebundenFlatBonus);
} else if (GebundenTypeGraph.IsChecked == true) {
SelectedGraphEntry.AddGebundenGraph();
DisableTextBox(GebundenFlatBonus);
if (ContractedTypeNone.IsChecked == true) {
SelectedGraphEntry.RemoveContractedGraph();
DisableTextBox(ContractedFlatBonus);
} else if (ContractedTypeFixed.IsChecked == true) {
SelectedGraphEntry.ContractedFlatBonus = double.TryParse(ContractedFlatBonus.Text, out var val) ? val : 0.1;
SelectedGraphEntry.AddContractedGraph();
EnableTextBox(ContractedFlatBonus);
} else if (ContractedTypeGraph.IsChecked == true) {
SelectedGraphEntry.AddContractedGraph();
DisableTextBox(ContractedFlatBonus);
}
SetHasChanged();
RefreshInputs();
}
private void CheckGebundenTypeFixed() {
private void CheckContractedTypeFixed() {
FillingInputs = true;
if (SelectedGraphEntry?.GebundenFlatBonus is double bonus) {
GebundenTypeFixed.IsChecked = true;
GebundenFlatBonus.Text = $"{bonus}";
EnableTextBox(GebundenFlatBonus);
} else if (SelectedGraphEntry?.GebundenGraph != null) {
GebundenTypeGraph.IsChecked = true;
GebundenFlatBonus.Text = "";
DisableTextBox(GebundenFlatBonus);
if (SelectedGraphEntry?.ContractedFlatBonus is double bonus) {
ContractedTypeFixed.IsChecked = true;
ContractedFlatBonus.Text = $"{bonus}";
EnableTextBox(ContractedFlatBonus);
} else if (SelectedGraphEntry?.ContractedGraph != null) {
ContractedTypeGraph.IsChecked = true;
ContractedFlatBonus.Text = "";
DisableTextBox(ContractedFlatBonus);
}
FillingInputs = false;
}