Elwig: Fix abgewertet/depreciated behaviour and rename to devalued
This commit is contained in:
1 parent
2ed559eb3f
commit
4ce6ce8248
24 files changed
+121
-107
No files matched your search
+1
-1
@@ -913,7 +913,7 @@ Changelog
|
||||
|
||||
### Neue Funktionen {#v0.13.2-features}
|
||||
|
||||
- Im Lieferungen-Fenster den Menüpunkt _Abwertungsliste_ (`DeliveryDepreciationList`) hinzugefügt. (3cbffdbf27)
|
||||
- Im Lieferungen-Fenster den Menüpunkt _Abwertungsliste_ (`DeliveryDevaluationList`) hinzugefügt. (3cbffdbf27)
|
||||
|
||||
### Behobene Fehler {#v0.13.2-bugfixes}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
||||
<RadioButton x:Name="DepreciateModeInput" GroupName="ModeInput" Content="Abwerten" Margin="15,10,10,10" IsChecked="True"
|
||||
<RadioButton x:Name="DevalueModeInput" GroupName="ModeInput" Content="Abwerten" Margin="15,10,10,10" IsChecked="True"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Checked="ModeInput_Changed"/>
|
||||
<RadioButton x:Name="MemberModeInput" GroupName="ModeInput" Content="Auf Mitglied übertragen" Margin="15,30,10,10"
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Elwig.Dialogs {
|
||||
}
|
||||
|
||||
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (DepreciateModeInput.IsChecked == true) {
|
||||
if (DevalueModeInput.IsChecked == true) {
|
||||
MgNr = null;
|
||||
LsNr = null;
|
||||
} else if (MemberModeInput.IsChecked == true) {
|
||||
@@ -72,7 +72,7 @@ namespace Elwig.Dialogs {
|
||||
private void ModeInput_Changed(object sender, RoutedEventArgs evt) {
|
||||
if (!IsLoaded) return;
|
||||
CheckValidity();
|
||||
if (DepreciateModeInput.IsChecked == true) {
|
||||
if (DevalueModeInput.IsChecked == true) {
|
||||
MgNrInput.Visibility = Visibility.Hidden;
|
||||
MemberInput.Visibility = Visibility.Hidden;
|
||||
MemberReferenceButton.Visibility = Visibility.Hidden;
|
||||
@@ -95,7 +95,7 @@ namespace Elwig.Dialogs {
|
||||
var total = DeliveryParts.Sum(r => r.Part.Weight);
|
||||
InfoBlock.Text = $"Insgesamt {weight:N0} kg / {total:N0} kg ausgewählt.";
|
||||
ConfirmButton.IsEnabled = DeliveryParts.Any(r => r.SplitCompletely || r.SplitWeight > 0) && (
|
||||
DepreciateModeInput.IsChecked == true ||
|
||||
DevalueModeInput.IsChecked == true ||
|
||||
(MemberModeInput.IsChecked == true && MemberInput.SelectedItem != null && !DeliveryParts.All(r => r.SplitCompletely)) ||
|
||||
(DeliveryModeInput.IsChecked == true && DeliveryInput.SelectedItem != null));
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Elwig.Documents {
|
||||
.SetPaddingsMM(1, 1, 0, 1))
|
||||
.AddCell(NewTd("Davon abgewertet:", 10, colspan: 7)
|
||||
.SetPaddingsMM(0, 1, 0.5f, 1))
|
||||
.AddCell(NewTd($"{data.Rows.Where(p => p.IsDepreciated).Sum(p => p.Weight):N0}", 10, colspan: 2, right: true)
|
||||
.AddCell(NewTd($"{data.Rows.Where(p => p.IsDevalued).Sum(p => p.Weight):N0}", 10, colspan: 2, right: true)
|
||||
.SetPaddingsMM(0, 1, 0.5f, 1))
|
||||
.AddCell(NewCell(colspan: 2)
|
||||
.SetPaddingsMM(0, 1, 0.5f, 1));
|
||||
|
||||
+3
-3
@@ -6,20 +6,20 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public class DeliveryDepreciationList : Document {
|
||||
public class DeliveryDevaluationList : Document {
|
||||
|
||||
public new static string Name => "Abwertungsliste";
|
||||
|
||||
public string Filter;
|
||||
public List<DeliveryJournalRow> Deliveries;
|
||||
|
||||
public DeliveryDepreciationList(string filter, IEnumerable<DeliveryJournalRow> deliveries) :
|
||||
public DeliveryDevaluationList(string filter, IEnumerable<DeliveryJournalRow> deliveries) :
|
||||
base($"{Name} {filter}") {
|
||||
Filter = filter;
|
||||
Deliveries = [.. deliveries];
|
||||
}
|
||||
|
||||
public DeliveryDepreciationList(string filter, DeliveryJournalData data) :
|
||||
public DeliveryDevaluationList(string filter, DeliveryJournalData data) :
|
||||
this(filter, data.Rows) {
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Elwig.Helpers {
|
||||
public static class AppDbUpdater {
|
||||
|
||||
// Don't forget to update value in Tests/fetch-resources.bat!
|
||||
public static readonly int RequiredSchemaVersion = 43;
|
||||
public static readonly int RequiredSchemaVersion = 44;
|
||||
|
||||
private static int VersionOffset = 0;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Elwig.Helpers.Billing {
|
||||
SELECT mgnr, did, dpnr, sortid, weight, kmw, qualid, attrid, modifiers, contracted
|
||||
FROM v_delivery
|
||||
WHERE year = {Year}
|
||||
ORDER BY mgnr, sortid, abgewertet ASC, {(honorContracted ? "contracted IS NOT NULL DESC, contracted DESC," : "")}
|
||||
ORDER BY mgnr, sortid, devalued ASC, {(honorContracted ? "contracted IS NOT NULL DESC, contracted DESC," : "")}
|
||||
attribute_prio DESC, COALESCE(attrid, '~'), kmw DESC, lsnr, dpnr
|
||||
""";
|
||||
using var reader = await cmd.ExecuteReaderAsync();
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace Elwig.Helpers.Billing {
|
||||
foreach (var c in entry.Vaributes) {
|
||||
var v = new RawVaribute(c.Variety!.SortId, c.Attribute?.AttrId ?? "", c.Cultivation?.CultId);
|
||||
if (v.CultId == "") v.CultId = null;
|
||||
if (entry.Abgewertet) {;
|
||||
if (entry.IsDevalued) {;
|
||||
qualityWei[v.ToString()] = node.DeepClone();
|
||||
} else {
|
||||
payment[v.ToString()] = node.DeepClone();
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Elwig.Helpers.Billing {
|
||||
var list = (await CreateGraphEntries(ctx, season.Precision, curves, entries)).Where(e => e.Vaributes.Count > 0);
|
||||
foreach (var e in list) {
|
||||
e.Id += idOffset;
|
||||
e.Abgewertet = true;
|
||||
e.IsDevalued = true;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Elwig.Helpers.Billing {
|
||||
|
||||
public int Id { get; set; }
|
||||
public BillingData.CurveMode Mode { get; set; }
|
||||
public bool Abgewertet { get; set; }
|
||||
public bool IsDevalued { get; set; }
|
||||
|
||||
public Graph DataGraph { get; set; }
|
||||
public Graph? ContractedGraph { get; set; }
|
||||
@@ -38,9 +38,9 @@ namespace Elwig.Helpers.Billing {
|
||||
}
|
||||
|
||||
public List<Varibute> Vaributes { get; set; }
|
||||
public string VaributeStringSimple => (Abgewertet ? "Abgew.: " : "") + (Vaributes.Count != 0 ? (Vaributes.Count >= 25 ? "Restliche Sorten" : string.Join(", ", Vaributes.Select(c => c.Listing))) : "-");
|
||||
public string VaributeStringSimple => (IsDevalued ? "Abgew.: " : "") + (Vaributes.Count != 0 ? (Vaributes.Count >= 25 ? "Restliche Sorten" : string.Join(", ", Vaributes.Select(c => c.Listing))) : "-");
|
||||
public string VaributeString => Vaributes.Count != 0 ? string.Join("\n", Vaributes.Select(c => c.FullName)) : "-";
|
||||
public string VaributeStringChange => (Abgewertet ? "A." : "") + string.Join(",", Vaributes.Select(c => c.Listing));
|
||||
public string VaributeStringChange => (IsDevalued ? "A." : "") + string.Join(",", Vaributes.Select(c => c.Listing));
|
||||
public Brush? Color => Vaributes.Select(v => v.Variety?.Color).Distinct().SingleOrDefault();
|
||||
private readonly int Precision;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Elwig.Helpers.Billing {
|
||||
public WineAttr? Attribute { get; }
|
||||
public WineCult? Cultivation { get; }
|
||||
public int? AssignedGraphId { get; set; }
|
||||
public int? AssignedAbgewGraphId { get; set; }
|
||||
public int? AssignedDevaluedGraphId { get; set; }
|
||||
|
||||
public string Listing => $"{Variety?.SortId}" +
|
||||
(Attribute != null ? $"/{Attribute.AttrId}" : "") +
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Elwig.Models.Dtos {
|
||||
FROM v_delivery v
|
||||
JOIN delivery_part p ON (p.year, p.did, p.dpnr) = (v.year, v.did, v.dpnr)
|
||||
WHERE (p.year = {year} OR {year} IS NULL) AND (v.mgnr = {mgnr} OR {mgnr} IS NULL)
|
||||
ORDER BY p.year, v.mgnr, v.sortid, v.abgewertet ASC, v.attribute_prio DESC, COALESCE(v.attrid, '~'), v.kmw DESC, v.lsnr, v.dpnr
|
||||
ORDER BY p.year, v.mgnr, v.sortid, v.devalued ASC, v.attribute_prio DESC, COALESCE(v.attrid, '~'), v.kmw DESC, v.lsnr, v.dpnr
|
||||
""").IgnoreAutoIncludes().ToListAsync();
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace Elwig.Models.Dtos {
|
||||
public string? Cultivation;
|
||||
public string QualityLevel;
|
||||
public string QualId;
|
||||
public bool IsDepreciated;
|
||||
public bool IsDevalued;
|
||||
public (double Oe, double Kmw) Gradation;
|
||||
public string[] Modifiers;
|
||||
public int Weight;
|
||||
@@ -89,7 +89,7 @@ namespace Elwig.Models.Dtos {
|
||||
Cultivation = p.Cultivation?.Name;
|
||||
QualityLevel = p.Quality.Name;
|
||||
QualId = p.Quality.QualId;
|
||||
IsDepreciated = p.QualId == "WEI";
|
||||
IsDevalued = p.QualId == "WEI";
|
||||
Gradation = (p.Oe, p.Kmw);
|
||||
Modifiers = [.. p.Modifiers.Select(m => m.Name)];
|
||||
Weight = p.Weight;
|
||||
|
||||
@@ -61,6 +61,9 @@ namespace Elwig.Models.Entities {
|
||||
[ForeignKey("QualId")]
|
||||
public virtual WineQualLevel Quality { get; init; } = null!;
|
||||
|
||||
[NotMapped]
|
||||
public bool IsDevalued => QualId == "WEI";
|
||||
|
||||
[Column("hkid")]
|
||||
public required string HkId { get; set; }
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
-- schema version 43 to 44
|
||||
|
||||
PRAGMA writable_schema = ON;
|
||||
|
||||
UPDATE sqlite_schema SET sql = REPLACE(sql,
|
||||
'IN (SELECT l.qualid FROM wine_quality_level l WHERE NOT l.predicate AND (p.kmw >= l.min_kmw OR l.min_kmw IS NULL) ORDER BY l.min_kmw DESC LIMIT 1,100) AS abgewertet',
|
||||
'= ''WEI'' AS devalued')
|
||||
WHERE type = 'view' AND name = 'v_delivery';
|
||||
|
||||
PRAGMA schema_version = 4301;
|
||||
PRAGMA writable_schema = OFF;
|
||||
@@ -720,7 +720,7 @@ namespace Elwig.Services {
|
||||
});
|
||||
}
|
||||
|
||||
public static async Task DepreciateDelivery(int year, int did, int[] weights) {
|
||||
public static async Task DevalueDelivery(int year, int did, int[] weights) {
|
||||
await Task.Run(async () => {
|
||||
using var ctx = new AppDbContext();
|
||||
var d = await ctx.Deliveries
|
||||
@@ -890,7 +890,7 @@ namespace Elwig.Services {
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task GenerateDeliveryDepreciationList(this DeliveryAdminViewModel vm, ExportSubject subject, ExportMode mode) {
|
||||
public static async Task GenerateDeliveryDevaluationList(this DeliveryAdminViewModel vm, ExportSubject subject, ExportMode mode) {
|
||||
using var ctx = new AppDbContext();
|
||||
IQueryable<DeliveryPart> query;
|
||||
List<string> filterNames = [];
|
||||
@@ -917,17 +917,17 @@ namespace Elwig.Services {
|
||||
filterNames.Remove("abgewertet");
|
||||
|
||||
if (mode == ExportMode.SaveList) {
|
||||
var filename = InteractionService.SaveFile(DeliveryDepreciationList.Name, $"{DeliveryDepreciationList.Name}-{vm.FilterSeason ?? Utils.CurrentLastSeason}", "ods");
|
||||
var filename = InteractionService.SaveFile(DeliveryDevaluationList.Name, $"{DeliveryDevaluationList.Name}-{vm.FilterSeason ?? Utils.CurrentLastSeason}", "ods");
|
||||
if (filename != null) {
|
||||
await Utils.RunForeground(async () => {
|
||||
using var ods = new OdsFile(filename);
|
||||
var tblTotal = await DeliveryJournalData.FromQuery(query, filterNames);
|
||||
tblTotal.FullName = DeliveryDepreciationList.Name;
|
||||
tblTotal.FullName = DeliveryDevaluationList.Name;
|
||||
tblTotal.Name = "Gesamt";
|
||||
await ods.AddTable(tblTotal);
|
||||
foreach (var branch in await ctx.FetchBranches().ToListAsync()) {
|
||||
var tbl = await DeliveryJournalData.FromQuery(query.Where(p => p.Delivery.ZwstId == branch.ZwstId), filterNames);
|
||||
tbl.FullName = DeliveryDepreciationList.Name;
|
||||
tbl.FullName = DeliveryDevaluationList.Name;
|
||||
tbl.Name = branch.Name;
|
||||
await ods.AddTable(tbl);
|
||||
}
|
||||
@@ -936,7 +936,7 @@ namespace Elwig.Services {
|
||||
} else {
|
||||
await Utils.RunForeground(async () => {
|
||||
var data = await DeliveryJournalData.FromQuery(query, filterNames);
|
||||
using var doc = new DeliveryDepreciationList(string.Join(" / ", filterNames), data);
|
||||
using var doc = new DeliveryDevaluationList(string.Join(" / ", filterNames), data);
|
||||
await Utils.ExportDocument(doc, mode);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Elwig.ViewModels {
|
||||
[ObservableProperty]
|
||||
public partial IEnumerable<WineQualLevel> WineQualityLevelSource { get; set; } = [];
|
||||
[ObservableProperty]
|
||||
public partial bool Abgewertet { get; set; }
|
||||
public partial bool IsDevalued { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string? WeightString { get; set; }
|
||||
|
||||
@@ -79,13 +79,13 @@
|
||||
<TextBlock Text="{Binding Attribute.Name}" Width="80"/>
|
||||
<TextBlock Text="{Binding Cultivation.Name}" Width="80"/>
|
||||
<TextBlock Text="{Binding AssignedGraphId}" Width="30"/>
|
||||
<TextBlock Text="{Binding AssignedAbgewGraphId}" Width="30"/>
|
||||
<TextBlock Text="{Binding AssignedDevaluedGraphId}" Width="30"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ctrl:CheckComboBox.ItemTemplate>
|
||||
</ctrl:CheckComboBox>
|
||||
|
||||
<CheckBox x:Name="AbgewertetInput" Content="Abgewertet" IsEnabled="False" Checked="AbgewertetInput_Changed" Unchecked="AbgewertetInput_Changed"
|
||||
<CheckBox x:Name="DevaluedInput" Content="Abgewertet" IsEnabled="False" Checked="DevaluedInput_Changed" Unchecked="DevaluedInput_Changed"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Column="1"/>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Elwig.Windows {
|
||||
private GraphEntry? SelectedGraphEntry => (GraphEntry)GraphList.SelectedItem;
|
||||
private List<Varibute> Vaributes = [];
|
||||
private bool AllVaributesAssigned => Vaributes.All(v => v.AssignedGraphId != null);
|
||||
private bool AllVaributesAssignedAbgew => Vaributes.All(v => v.AssignedAbgewGraphId != null);
|
||||
private bool AllVaributesAssignedDevalued => Vaributes.All(v => v.AssignedDevaluedGraphId != null);
|
||||
|
||||
public ChartWindow(int year, int avnr) {
|
||||
InitializeComponent();
|
||||
@@ -126,8 +126,8 @@ namespace Elwig.Windows {
|
||||
e.Vaributes.ForEach(v => {
|
||||
var found = Vaributes.Find(a => a.Variety?.SortId == v.Variety?.SortId && a.Attribute?.AttrId == v.Attribute?.AttrId && a.Cultivation?.CultId == v.Cultivation?.CultId);
|
||||
if (found == null) return;
|
||||
if (e.Abgewertet) {
|
||||
found.AssignedAbgewGraphId = e.Id;
|
||||
if (e.IsDevalued) {
|
||||
found.AssignedDevaluedGraphId = e.Id;
|
||||
} else {
|
||||
found.AssignedGraphId = e.Id;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace Elwig.Windows {
|
||||
ContractedTypeGraph.IsEnabled = true;
|
||||
ContractedTypeNone.IsEnabled = true;
|
||||
VaributeInput.IsEnabled = true;
|
||||
AbgewertetInput.IsEnabled = true;
|
||||
DevaluedInput.IsEnabled = true;
|
||||
EnableOptionButtons();
|
||||
FillInputs();
|
||||
} else {
|
||||
@@ -172,7 +172,7 @@ namespace Elwig.Windows {
|
||||
ContractedTypeGraph.IsEnabled = false;
|
||||
ContractedTypeNone.IsEnabled = false;
|
||||
VaributeInput.IsEnabled = false;
|
||||
AbgewertetInput.IsEnabled = false;
|
||||
DevaluedInput.IsEnabled = false;
|
||||
}
|
||||
GC.Collect();
|
||||
}
|
||||
@@ -180,7 +180,7 @@ namespace Elwig.Windows {
|
||||
private void FillInputs() {
|
||||
FillingInputs = true;
|
||||
|
||||
AbgewertetInput.IsChecked = SelectedGraphEntry?.Abgewertet;
|
||||
DevaluedInput.IsChecked = SelectedGraphEntry?.IsDevalued;
|
||||
if (SelectedGraphEntry?.ContractedFlatBonus is double bonus) {
|
||||
ContractedTypeFixed.IsChecked = true;
|
||||
ContractedFlatBonus.Text = $"{bonus}";
|
||||
@@ -652,7 +652,7 @@ namespace Elwig.Windows {
|
||||
using var ctx = new AppDbContext();
|
||||
var origData = BillingData.FromJson(PaymentVar.Data);
|
||||
var data = BillingData.FromGraphEntries(GraphEntries, origData, await Utils.GetVaributes(ctx, Year),
|
||||
AllVaributesAssigned, AllVaributesAssignedAbgew);
|
||||
AllVaributesAssigned, AllVaributesAssignedDevalued);
|
||||
|
||||
PaymentVar.Data = data.ToJsonString();
|
||||
ctx.Update(PaymentVar);
|
||||
@@ -747,8 +747,8 @@ namespace Elwig.Windows {
|
||||
foreach (var i in evt.AddedItems) {
|
||||
if (i is not Varibute v) continue;
|
||||
if (RemoveVaributeFromOthers(v.ToString())) {
|
||||
if (AbgewertetInput.IsChecked == true) {
|
||||
v.AssignedAbgewGraphId = SelectedGraphEntry?.Id;
|
||||
if (DevaluedInput.IsChecked == true) {
|
||||
v.AssignedDevaluedGraphId = SelectedGraphEntry?.Id;
|
||||
} else {
|
||||
v.AssignedGraphId = SelectedGraphEntry?.Id;
|
||||
}
|
||||
@@ -758,8 +758,8 @@ namespace Elwig.Windows {
|
||||
}
|
||||
foreach (var i in evt.RemovedItems) {
|
||||
if (i is not Varibute v) continue;
|
||||
if (AbgewertetInput.IsChecked == true) {
|
||||
v.AssignedAbgewGraphId = null;
|
||||
if (DevaluedInput.IsChecked == true) {
|
||||
v.AssignedDevaluedGraphId = null;
|
||||
} else {
|
||||
v.AssignedGraphId = null;
|
||||
}
|
||||
@@ -775,7 +775,7 @@ namespace Elwig.Windows {
|
||||
private bool RemoveVaributeFromOthers(string? varibute) {
|
||||
if (varibute == null) return true;
|
||||
foreach (var ge in GraphEntries) {
|
||||
if (ge != SelectedGraphEntry && ge.Abgewertet == SelectedGraphEntry?.Abgewertet) {
|
||||
if (ge != SelectedGraphEntry && ge.IsDevalued == SelectedGraphEntry?.IsDevalued) {
|
||||
var toRemove = ge.Vaributes.Where(c => c.Listing.Equals(varibute)).ToList();
|
||||
if (toRemove.Count == 0) continue;
|
||||
if (!InteractionService.AskConfirmation("Entfernen bestätigen", $"Achtung: {string.Join(", ", toRemove)} ist bereits in Kurve {ge.Id} in Verwendung!\nSoll die Zuweisung dort entfernt werden?")) {
|
||||
@@ -787,10 +787,10 @@ namespace Elwig.Windows {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AbgewertetInput_Changed(object sender, RoutedEventArgs e) {
|
||||
private void DevaluedInput_Changed(object sender, RoutedEventArgs e) {
|
||||
if (FillingInputs) return;
|
||||
if (SelectedGraphEntry == null) return;
|
||||
SelectedGraphEntry.Abgewertet = AbgewertetInput.IsChecked == true;
|
||||
SelectedGraphEntry.IsDevalued = DevaluedInput.IsChecked == true;
|
||||
SetHasChanged();
|
||||
GraphList.Items.Refresh();
|
||||
}
|
||||
|
||||
@@ -109,24 +109,24 @@
|
||||
<MenuItem x:Name="Menu_DeliveryJournal_PrintToday" Header="...von heute drucken"
|
||||
Click="Menu_DeliveryJournal_PrintToday_Click" InputGestureText="Strg+J"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Abwertungsliste" x:Name="Menu_DeliveryDepreciationList">
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_SaveFilters" Header="...aus Filtern speichern... (Excel)"
|
||||
Click="Menu_DeliveryDepreciationList_SaveFilters_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_ShowFilters" Header="...aus Filtern anzeigen (PDF)"
|
||||
Click="Menu_DeliveryDepreciationList_ShowFilters_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_SavePdfFilters" Header="...aus Filtern speichern... (PDF)"
|
||||
Click="Menu_DeliveryDepreciationList_SavePdfFilters_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_PrintFilters" Header="...aus Filtern drucken"
|
||||
Click="Menu_DeliveryDepreciationList_PrintFilters_Click"/>
|
||||
<MenuItem Header="Abwertungsliste" x:Name="Menu_DeliveryDevaluationList">
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_SaveFilters" Header="...aus Filtern speichern... (Excel)"
|
||||
Click="Menu_DeliveryDevaluationList_SaveFilters_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_ShowFilters" Header="...aus Filtern anzeigen (PDF)"
|
||||
Click="Menu_DeliveryDevaluationList_ShowFilters_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_SavePdfFilters" Header="...aus Filtern speichern... (PDF)"
|
||||
Click="Menu_DeliveryDevaluationList_SavePdfFilters_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_PrintFilters" Header="...aus Filtern drucken"
|
||||
Click="Menu_DeliveryDevaluationList_PrintFilters_Click"/>
|
||||
<Separator/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_SaveSeason" Header="...von Saison speichern... (Excel)"
|
||||
Click="Menu_DeliveryDepreciationList_SaveSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_ShowSeason" Header="...von Saison anzeigen (PDF)"
|
||||
Click="Menu_DeliveryDepreciationList_ShowSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_SavePdfSeason" Header="...von Saison speichern... (PDF)"
|
||||
Click="Menu_DeliveryDepreciationList_SavePdfSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDepreciationList_PrintSeason" Header="...von Saison drucken"
|
||||
Click="Menu_DeliveryDepreciationList_PrintSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_SaveSeason" Header="...von Saison speichern... (Excel)"
|
||||
Click="Menu_DeliveryDevaluationList_SaveSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_ShowSeason" Header="...von Saison anzeigen (PDF)"
|
||||
Click="Menu_DeliveryDevaluationList_ShowSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_SavePdfSeason" Header="...von Saison speichern... (PDF)"
|
||||
Click="Menu_DeliveryDevaluationList_SavePdfSeason_Click"/>
|
||||
<MenuItem x:Name="Menu_DeliveryDevaluationList_PrintSeason" Header="...von Saison drucken"
|
||||
Click="Menu_DeliveryDevaluationList_PrintSeason_Click"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Liefermengen" x:Name="Menu_DeliveryDataList">
|
||||
<MenuItem x:Name="Menu_DeliveryDataList_SaveFilters" Header="...aus Filtern speichern... (Excel)"
|
||||
@@ -357,10 +357,10 @@
|
||||
<TextBlock FontWeight="Bold">Alt+Einfg</TextBlock>
|
||||
</Button.ToolTip>
|
||||
</Button>
|
||||
<Button x:Name="DepreciateButton" Content="Abwert./Aufteil." IsEnabled="False"
|
||||
<Button x:Name="DevalueButton" Content="Abwert./Aufteil." IsEnabled="False"
|
||||
ToolTip="Lieferung vollständig oder teilweise abwerten bzw. auf anderes Mitglied aufteilen"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="5,5,2.5,10" Grid.Column="0" Grid.Row="2"
|
||||
Click="DepreciateButton_Click"/>
|
||||
Click="DevalueButton_Click"/>
|
||||
<Button x:Name="EditDeliveryButton" Content="Bearbeiten" IsEnabled="False"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="2.5,5,2.5,10" Grid.Column="1" Grid.Row="2"
|
||||
Click="EditDeliveryButton_Click">
|
||||
@@ -555,7 +555,7 @@
|
||||
</ComboBox.ItemTemplateSelector>
|
||||
</ComboBox>
|
||||
|
||||
<CheckBox x:Name="AbgewertetInput" IsChecked="{Binding Abgewertet, Mode=TwoWay}"
|
||||
<CheckBox x:Name="DevaluedInput" IsChecked="{Binding IsDevalued, Mode=TwoWay}"
|
||||
Content="Abgewertet" IsEnabled="False"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"/>
|
||||
</Grid>
|
||||
|
||||
@@ -261,22 +261,22 @@ namespace Elwig.Windows {
|
||||
private async void Menu_Statistic_Locality_SaveFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateLocalityStatistics(DeliveryService.ExportSubject.FromFilters);
|
||||
|
||||
private async void Menu_DeliveryDepreciationList_SaveFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromFilters, ExportMode.SaveList);
|
||||
private async void Menu_DeliveryDepreciationList_ShowFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromFilters, ExportMode.Show);
|
||||
private async void Menu_DeliveryDepreciationList_SavePdfFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromFilters, ExportMode.SavePdf);
|
||||
private async void Menu_DeliveryDepreciationList_PrintFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromFilters, ExportMode.Print);
|
||||
private async void Menu_DeliveryDepreciationList_SaveSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromSeason, ExportMode.SaveList);
|
||||
private async void Menu_DeliveryDepreciationList_ShowSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromSeason, ExportMode.Show);
|
||||
private async void Menu_DeliveryDepreciationList_SavePdfSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromSeason, ExportMode.SavePdf);
|
||||
private async void Menu_DeliveryDepreciationList_PrintSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDepreciationList(DeliveryService.ExportSubject.FromSeason, ExportMode.Print);
|
||||
private async void Menu_DeliveryDevaluationList_SaveFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromFilters, ExportMode.SaveList);
|
||||
private async void Menu_DeliveryDevaluationList_ShowFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromFilters, ExportMode.Show);
|
||||
private async void Menu_DeliveryDevaluationList_SavePdfFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromFilters, ExportMode.SavePdf);
|
||||
private async void Menu_DeliveryDevaluationList_PrintFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromFilters, ExportMode.Print);
|
||||
private async void Menu_DeliveryDevaluationList_SaveSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromSeason, ExportMode.SaveList);
|
||||
private async void Menu_DeliveryDevaluationList_ShowSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromSeason, ExportMode.Show);
|
||||
private async void Menu_DeliveryDevaluationList_SavePdfSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromSeason, ExportMode.SavePdf);
|
||||
private async void Menu_DeliveryDevaluationList_PrintSeason_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDevaluationList(DeliveryService.ExportSubject.FromSeason, ExportMode.Print);
|
||||
|
||||
private async void Menu_DeliveryDataList_SaveFilters_Click(object sender, RoutedEventArgs evt) =>
|
||||
await ViewModel.GenerateDeliveryDataList(DeliveryService.ExportSubject.FromFilters, ExportMode.SaveList);
|
||||
@@ -762,10 +762,10 @@ namespace Elwig.Windows {
|
||||
private void DeliveryPartList_SelectionChanged(object? sender, SelectionChangedEventArgs? evt) {
|
||||
RefreshInputs();
|
||||
if (DeliveryPartList.SelectedItem is DeliveryPart p) {
|
||||
DepreciateButton.IsEnabled = true;
|
||||
DevalueButton.IsEnabled = true;
|
||||
EditDeliveryButton.IsEnabled = true;
|
||||
} else {
|
||||
DepreciateButton.IsEnabled = false;
|
||||
DevalueButton.IsEnabled = false;
|
||||
EditDeliveryButton.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
@@ -959,7 +959,7 @@ namespace Elwig.Windows {
|
||||
LockSearchInputs();
|
||||
}
|
||||
|
||||
private async void DepreciateButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void DevalueButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (DeliveryList.SelectedItem is not Delivery d) return;
|
||||
var res = Utils.ShowDeliverySplittingDialog(d);
|
||||
if (res == null)
|
||||
@@ -971,7 +971,7 @@ namespace Elwig.Windows {
|
||||
var weights = res.Value.Item2;
|
||||
if (id == null) {
|
||||
// abwerten
|
||||
await DeliveryService.DepreciateDelivery(d.Year, d.DId, weights);
|
||||
await DeliveryService.DevalueDelivery(d.Year, d.DId, weights);
|
||||
} else if (id.All(char.IsAsciiDigit)) {
|
||||
// auf Mitglied übertragen
|
||||
var n = await DeliveryService.SplitDeliveryToMember(d.Year, d.DId, weights, int.Parse(id));
|
||||
@@ -1020,7 +1020,7 @@ namespace Elwig.Windows {
|
||||
UnlockInputs();
|
||||
LockSearchInputs();
|
||||
|
||||
DepreciateButton.IsEnabled = false;
|
||||
DevalueButton.IsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void ShortcutDelete() {
|
||||
@@ -1091,7 +1091,7 @@ namespace Elwig.Windows {
|
||||
await EnsureContextRenewed();
|
||||
|
||||
Mouse.OverrideCursor = null;
|
||||
DepreciateButton.IsEnabled = true;
|
||||
DevalueButton.IsEnabled = true;
|
||||
}
|
||||
|
||||
protected override void ShortcutReset() {
|
||||
@@ -1124,7 +1124,7 @@ namespace Elwig.Windows {
|
||||
LockInputs();
|
||||
UnlockSearchInputs();
|
||||
|
||||
DepreciateButton.IsEnabled = DeliveryPartList.SelectedItem != null;
|
||||
DevalueButton.IsEnabled = DeliveryPartList.SelectedItem != null;
|
||||
}
|
||||
|
||||
private void ShowSaveResetCancelButtons() {
|
||||
@@ -1147,22 +1147,22 @@ namespace Elwig.Windows {
|
||||
|
||||
private void ShowNewEditDeleteButtons() {
|
||||
NewDeliveryButton.IsEnabled = ViewModel.IsReceipt;
|
||||
DepreciateButton.IsEnabled = DeliveryList.SelectedItem != null;
|
||||
DevalueButton.IsEnabled = DeliveryList.SelectedItem != null;
|
||||
EditDeliveryButton.IsEnabled = DeliveryPartList.SelectedItem != null;
|
||||
DeleteDeliveryButton.IsEnabled = DeliveryList.SelectedItem != null;
|
||||
NewDeliveryButton.Visibility = ViewModel.IsReceipt ? Visibility.Visible : Visibility.Hidden;
|
||||
DepreciateButton.Visibility = !ViewModel.IsReceipt ? Visibility.Visible : Visibility.Hidden;
|
||||
DevalueButton.Visibility = !ViewModel.IsReceipt ? Visibility.Visible : Visibility.Hidden;
|
||||
EditDeliveryButton.Visibility = Visibility.Visible;
|
||||
DeleteDeliveryButton.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void HideNewEditDeleteButtons() {
|
||||
NewDeliveryButton.IsEnabled = false;
|
||||
DepreciateButton.IsEnabled = false;
|
||||
DevalueButton.IsEnabled = false;
|
||||
EditDeliveryButton.IsEnabled = false;
|
||||
DeleteDeliveryButton.IsEnabled = false;
|
||||
NewDeliveryButton.Visibility = Visibility.Hidden;
|
||||
DepreciateButton.Visibility = Visibility.Hidden;
|
||||
DevalueButton.Visibility = Visibility.Hidden;
|
||||
EditDeliveryButton.Visibility = Visibility.Hidden;
|
||||
DeleteDeliveryButton.Visibility = Visibility.Hidden;
|
||||
}
|
||||
@@ -1212,7 +1212,7 @@ namespace Elwig.Windows {
|
||||
if (WineKgInput.SelectedItem == null)
|
||||
WineRdInput.IsEnabled = false;
|
||||
WeightInput.IsReadOnly = true;
|
||||
AbgewertetInput.IsEnabled = false;
|
||||
DevaluedInput.IsEnabled = false;
|
||||
ManualWeighingInput.IsEnabled = false;
|
||||
LsNrInput.IsReadOnly = true;
|
||||
DateInput.IsReadOnly = !Menu_Settings_EnableFreeEditing.IsChecked;
|
||||
@@ -1495,7 +1495,7 @@ namespace Elwig.Windows {
|
||||
|
||||
private void WineQualityLevelInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
|
||||
UpdateWineOrigin();
|
||||
UpdateAbgewertet();
|
||||
UpdateDevalued();
|
||||
}
|
||||
|
||||
private void UpdateRdInput() {
|
||||
@@ -1517,10 +1517,10 @@ namespace Elwig.Windows {
|
||||
UpdateRdInput();
|
||||
}
|
||||
|
||||
private void UpdateAbgewertet() {
|
||||
private void UpdateDevalued() {
|
||||
if (!GetInputValid(GradationKmwInput))
|
||||
return;
|
||||
AbgewertetInput.IsChecked = WineQualityLevelInput.SelectedItem is WineQualLevel { QualId: "WEI" };
|
||||
DevaluedInput.IsChecked = WineQualityLevelInput.SelectedItem is WineQualLevel { QualId: "WEI" };
|
||||
}
|
||||
|
||||
private void WeightInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
|
||||
@@ -4,13 +4,13 @@ using Elwig.Models.Dtos;
|
||||
|
||||
namespace Tests.UnitTests.DocumentTests {
|
||||
[TestFixture]
|
||||
public class DeliveryDepreciationListTest {
|
||||
public class DeliveryDevaluationListTest {
|
||||
|
||||
[Test]
|
||||
public async Task Test_01_DepreciatedDeliveries2020() {
|
||||
public async Task Test_01_DevaluedDeliveries2020() {
|
||||
using var ctx = new AppDbContext();
|
||||
var data = await DeliveryJournalData.FromQuery(ctx.Deliveries.Where(d => d.Year == 2020).SelectMany(d => d.Parts).Where(d => d.QualId == "WEI"), ["Saison 2020"]);
|
||||
using var doc = new DeliveryDepreciationList("Saison 2020", data);
|
||||
using var doc = new DeliveryDevaluationList("Saison 2020", data);
|
||||
var text = await Utils.GeneratePdfText(doc, true);
|
||||
var table = Utils.ExtractTable(text);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
|
||||
@@ -721,7 +721,7 @@ namespace Tests.UnitTests.HelperTests {
|
||||
[73] = 0.2m,
|
||||
}, null), GetSelection(["ZW/-"]))
|
||||
];
|
||||
entries[0].Abgewertet = true;
|
||||
entries[0].IsDevalued = true;
|
||||
var data = BillingData.FromGraphEntries(entries);
|
||||
Assert.That(data.ToJsonString(JsonOpts), Is.EqualTo("""
|
||||
{
|
||||
|
||||
@@ -408,7 +408,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestSplit_01_Depreciate_One() {
|
||||
public async Task TestSplit_01_Devalue_One() {
|
||||
var d = await GetDelivery("20231001X001");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -420,7 +420,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
Assert.That(ps[2].QualId, Is.Not.EqualTo("WEI"));
|
||||
}
|
||||
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DepreciateDelivery(d.Year, d.DId, [1000, 0, 0]));
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DevalueDelivery(d.Year, d.DId, [1000, 0, 0]));
|
||||
d = await GetDelivery("20231001X001");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -434,7 +434,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestSplit_02_Depreciate_Partial() {
|
||||
public async Task TestSplit_02_Devalue_Partial() {
|
||||
var d = await GetDelivery("20231001X002");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -446,7 +446,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
Assert.That(ps[2].QualId, Is.Not.EqualTo("WEI"));
|
||||
}
|
||||
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DepreciateDelivery(d.Year, d.DId, [600, 0, 0]));
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DevalueDelivery(d.Year, d.DId, [600, 0, 0]));
|
||||
d = await GetDelivery("20231001X002");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -462,7 +462,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestSplit_03_Depreciate_Mixed() {
|
||||
public async Task TestSplit_03_Devalue_Mixed() {
|
||||
var d = await GetDelivery("20231001X003");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -475,7 +475,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
Assert.That(ps[2].QualId, Is.Not.EqualTo("WEI"));
|
||||
}
|
||||
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DepreciateDelivery(d.Year, d.DId, [1000, 700, -5]));
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DevalueDelivery(d.Year, d.DId, [1000, 700, -5]));
|
||||
d = await GetDelivery("20231001X003");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -493,7 +493,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestSplit_04_Depreciate_Complete() {
|
||||
public async Task TestSplit_04_Devalue_Complete() {
|
||||
var d = await GetDelivery("20231001X004");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
@@ -507,7 +507,7 @@ namespace Tests.UnitTests.ServiceTests {
|
||||
Assert.That(ps[2].QualId, Is.Not.EqualTo("WEI"));
|
||||
}
|
||||
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DepreciateDelivery(d.Year, d.DId, [1000, 1100, int.MaxValue]));
|
||||
await Assert.DoesNotThrowAsync(async () => await DeliveryService.DevalueDelivery(d.Year, d.DId, [1000, 1100, int.MaxValue]));
|
||||
d = await GetDelivery("20231001X004");
|
||||
Assert.That(d, Is.Not.Null);
|
||||
using (Assert.EnterMultipleScope()) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=43" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||
curl --fail -s -L "https://elwig.at/files/create.sql?v=44" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||
Reference in new issue
Block a user