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
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user