Documents: Add DeliveryDepreciationList
All checks were successful
Test / Run tests (push) Successful in 1m55s
All checks were successful
Test / Run tests (push) Successful in 1m55s
This commit is contained in:
@ -9,8 +9,8 @@
|
||||
<table class="credit">
|
||||
<colgroup>
|
||||
<col style="width: 25mm;"/>
|
||||
<col style="width: 5mm;"/>
|
||||
<col style="width: 22mm;"/>
|
||||
<col style="width: 6mm;"/>
|
||||
<col style="width: 21mm;"/>
|
||||
<col style="width: 15mm;"/>
|
||||
<col style="width: 10mm;"/>
|
||||
<col style="width: 10mm;"/>
|
||||
@ -51,7 +51,7 @@
|
||||
<tr class="@(i == 0 ? "first" : "") @(rows == i + 1 ? "last" : "")">
|
||||
@if (i == 0) {
|
||||
<td rowspan="@rows">@p.LsNr</td>
|
||||
<td rowspan="@rows">@p.DPNr</td>
|
||||
<td rowspan="@rows" class="center narrow">@p.DPNr</td>
|
||||
<td class="small">@p.Variety</td>
|
||||
<td class="small">
|
||||
@p.Attribute@(p.Attribute != null && p.Cultivation != null ? " / " : "")@p.Cultivation
|
||||
|
@ -9,8 +9,8 @@
|
||||
<table class="delivery-confirmation">
|
||||
<colgroup>
|
||||
<col style="width: 25mm;"/>
|
||||
<col style="width: 5mm;"/>
|
||||
<col style="width: 24mm;"/>
|
||||
<col style="width: 6mm;"/>
|
||||
<col style="width: 23mm;"/>
|
||||
<col style="width: 16mm;"/>
|
||||
<col style="width: 17mm;"/>
|
||||
<col style="width: 10mm;"/>
|
||||
@ -60,7 +60,7 @@
|
||||
<tr class="@(first ? "first" : "") @(p.Variety != lastVariety && lastVariety != "" ? "new": "") @(rows > i + 1 ? "last" : "")">
|
||||
@if (first) {
|
||||
<td rowspan="@rows">@p.LsNr</td>
|
||||
<td rowspan="@rows">@p.DPNr</td>
|
||||
<td rowspan="@rows" class="center narrow">@p.DPNr</td>
|
||||
<td class="small">@p.Variety</td>
|
||||
<td class="small">@p.Attribute@(p.Attribute != null && p.Cultivation != null ? " / " : "")@p.Cultivation</td>
|
||||
<td class="small">@p.QualityLevel</td>
|
||||
|
22
Elwig/Documents/DeliveryDepreciationList.cs
Normal file
22
Elwig/Documents/DeliveryDepreciationList.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Elwig.Models.Dtos;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public class DeliveryDepreciationList : Document {
|
||||
|
||||
public new static string Name => "Abwertungsliste";
|
||||
|
||||
public string Filter;
|
||||
public IEnumerable<DeliveryJournalRow> Deliveries;
|
||||
|
||||
public DeliveryDepreciationList(string filter, IEnumerable<DeliveryJournalRow> deliveries) :
|
||||
base($"{Name} {filter}") {
|
||||
Filter = filter;
|
||||
Deliveries = deliveries;
|
||||
}
|
||||
|
||||
public DeliveryDepreciationList(string filter, DeliveryJournalData data) :
|
||||
this(filter, data.Rows) {
|
||||
}
|
||||
}
|
||||
}
|
104
Elwig/Documents/DeliveryDepreciationList.cshtml
Normal file
104
Elwig/Documents/DeliveryDepreciationList.cshtml
Normal file
@ -0,0 +1,104 @@
|
||||
@using RazorLight
|
||||
@inherits TemplatePage<Elwig.Documents.DeliveryDepreciationList>
|
||||
@model Elwig.Documents.DeliveryDepreciationList
|
||||
@{ Layout = "Document"; }
|
||||
<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\DeliveryDepreciationList.css" />
|
||||
<main>
|
||||
<h1>Abwertungsliste</h1>
|
||||
<h2>@Model.Filter</h2>
|
||||
<table class="journal">
|
||||
<colgroup>
|
||||
<col style="width: 25mm;"/>
|
||||
<col style="width: 6mm;"/>
|
||||
<col style="width: 20mm;"/>
|
||||
<col style="width: 15mm;"/>
|
||||
<col style="width: 35mm;"/>
|
||||
<col style="width: 30mm;"/>
|
||||
<col style="width: 10mm;"/>
|
||||
<col style="width: 10mm;"/>
|
||||
<col style="width: 14mm;"/>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" style="text-align: left;">Lieferschein-Nr.</th>
|
||||
<th rowspan="2" class="narrow">Pos.</th>
|
||||
<th rowspan="2">Datum</th>
|
||||
<th rowspan="2">Zeit</th>
|
||||
<th rowspan="2" style="text-align: left;">Sorte</th>
|
||||
<th rowspan="2" style="text-align: left;">Attr./Bewirt.</th>
|
||||
<th colspan="2">Gradation</th>
|
||||
<th>Gewicht</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="unit">[°Oe]</th>
|
||||
<th class="unit narrow">[°KMW]</th>
|
||||
<th class="unit">[kg]</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
int? lastMember = null;
|
||||
}
|
||||
@foreach (var p in Model.Deliveries) {
|
||||
if (lastMember != p.MgNr) {
|
||||
<tr class="subheading @(lastMember != null ? "new" : "")">
|
||||
@{
|
||||
var memberDeliveries = Model.Deliveries.Where(d => d.MgNr == p.MgNr).ToList();
|
||||
var memberKmw = Elwig.Helpers.Utils.AggregateDeliveryPartsKmw(memberDeliveries);
|
||||
var memberOe = Elwig.Helpers.Utils.KmwToOe(memberKmw);
|
||||
}
|
||||
<th colspan="5">
|
||||
@($"{p.MgNr}, {p.AdministrativeName}")
|
||||
</th>
|
||||
<td>Teil-Lfrg.: <span style="float: right;">@($"{memberDeliveries.Count():N0}")</span></td>
|
||||
<td class="center">@($"{memberOe:N0}")</td>
|
||||
<td class="center">@($"{memberKmw:N1}")</td>
|
||||
<td class="number">@($"{memberDeliveries.Sum(p => p.Weight):N0}")</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>@p.LsNr</td>
|
||||
<td class="center narrow">@p.Pos</td>
|
||||
<td>@($"{p.Date:dd.MM.yyyy}")</td>
|
||||
<td>@($"{p.Time:HH:mm}")</td>
|
||||
<td>@p.Variety</td>
|
||||
<td>@p.Attribute@(p.Attribute != null && p.Cultivation != null ? " / " : "")@p.Cultivation</td>
|
||||
<td class="center">@($"{p.Oe:N0}")</td>
|
||||
<td class="center">@($"{p.Kmw:N1}")</td>
|
||||
<td class="number">@($"{p.Weight:N0}")</td>
|
||||
</tr>
|
||||
lastMember = p.MgNr;
|
||||
}
|
||||
@{
|
||||
var branches = Model.Deliveries.Select(d => d.DeliveryBranch).Distinct().Order().ToArray();
|
||||
if (branches.Length > 1) {
|
||||
foreach (var b in branches) {
|
||||
<tr class="@(branches[0] == b ? "sum" : "") bold">
|
||||
@{
|
||||
var branchDeliveries = Model.Deliveries.Where(d => d.DeliveryBranch == b).ToList();
|
||||
var branchKmw = Elwig.Helpers.Utils.AggregateDeliveryPartsKmw(branchDeliveries);
|
||||
var branchOe = Elwig.Helpers.Utils.KmwToOe(branchKmw);
|
||||
}
|
||||
<td colspan="2">@b:</td>
|
||||
<td colspan="4">(Teil-)Lieferungen: @($"{branchDeliveries.DistinctBy(p => p.LsNr).Count():N0}") (@($"{branchDeliveries.Count():N0}"))</td>
|
||||
<td class="center">@($"{branchOe:N0}")</td>
|
||||
<td class="center">@($"{branchKmw:N1}")</td>
|
||||
<td class="number">@($"{branchDeliveries.Sum(p => p.Weight):N0}")</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
<tr class="sum bold">
|
||||
@{
|
||||
var kmw = Elwig.Helpers.Utils.AggregateDeliveryPartsKmw(Model.Deliveries);
|
||||
var oe = Elwig.Helpers.Utils.KmwToOe(kmw);
|
||||
}
|
||||
<td colspan="2">Gesamt:</td>
|
||||
<td colspan="4">(Teil-)Lieferungen: @($"{Model.Deliveries.DistinctBy(p => p.LsNr).Count():N0}") (@($"{Model.Deliveries.Count():N0}"))</td>
|
||||
<td class="center">@($"{oe:N0}")</td>
|
||||
<td class="center">@($"{kmw:N1}")</td>
|
||||
<td class="number">@($"{Model.Deliveries.Sum(p => p.Weight):N0}")</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
13
Elwig/Documents/DeliveryDepreciationList.css
Normal file
13
Elwig/Documents/DeliveryDepreciationList.css
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: 24pt;
|
||||
margin-top: 10mm;
|
||||
margin-bottom: 2mm;
|
||||
}
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
font-size: 14pt;
|
||||
margin-top: 2mm;
|
||||
}
|
@ -9,7 +9,8 @@ namespace Elwig.Documents {
|
||||
public string Filter;
|
||||
public IEnumerable<DeliveryJournalRow> Deliveries;
|
||||
|
||||
public DeliveryJournal(string filter, IEnumerable<DeliveryJournalRow> deliveries) : base($"{Name} {filter}") {
|
||||
public DeliveryJournal(string filter, IEnumerable<DeliveryJournalRow> deliveries) :
|
||||
base($"{Name} {filter}") {
|
||||
Filter = filter;
|
||||
Deliveries = deliveries;
|
||||
}
|
||||
|
@ -9,10 +9,10 @@
|
||||
<table class="journal">
|
||||
<colgroup>
|
||||
<col style="width: 25mm;"/>
|
||||
<col style="width: 5mm;"/>
|
||||
<col style="width: 6mm;"/>
|
||||
<col style="width: 15mm;"/>
|
||||
<col style="width: 8mm;"/>
|
||||
<col style="width: 12mm;"/>
|
||||
<col style="width: 8mm;"/>
|
||||
<col style="width: 11mm;"/>
|
||||
<col style="width: 38mm;"/>
|
||||
<col style="width: 28mm;"/>
|
||||
<col style="width: 10mm;"/>
|
||||
@ -41,7 +41,7 @@
|
||||
@foreach (var p in Model.Deliveries) {
|
||||
<tr>
|
||||
<td>@p.LsNr</td>
|
||||
<td>@p.Pos</td>
|
||||
<td class="center narrow">@p.Pos</td>
|
||||
<td class="small">@($"{p.Date:dd.MM.yyyy}")</td>
|
||||
<td class="small">@($"{p.Time:HH:mm}")</td>
|
||||
<td class="number">@p.MgNr</td>
|
||||
@ -52,6 +52,25 @@
|
||||
<td class="number">@($"{p.Weight:N0}")</td>
|
||||
</tr>
|
||||
}
|
||||
@{
|
||||
var branches = Model.Deliveries.Select(d => d.DeliveryBranch).Distinct().Order().ToArray();
|
||||
if (branches.Length > 1) {
|
||||
foreach (var b in branches) {
|
||||
<tr class="@(branches[0] == b ? "sum" : "") bold">
|
||||
@{
|
||||
var branchDeliveries = Model.Deliveries.Where(d => d.DeliveryBranch == b).ToList();
|
||||
var branchKmw = Elwig.Helpers.Utils.AggregateDeliveryPartsKmw(branchDeliveries);
|
||||
var branchOe = Elwig.Helpers.Utils.KmwToOe(branchKmw);
|
||||
}
|
||||
<td colspan="2">@b:</td>
|
||||
<td colspan="5">(Teil-)Lieferungen: @($"{branchDeliveries.DistinctBy(p => p.LsNr).Count():N0}") (@($"{branchDeliveries.Count():N0}"))</td>
|
||||
<td class="center">@($"{branchOe:N0}")</td>
|
||||
<td class="center">@($"{branchKmw:N1}")</td>
|
||||
<td class="number">@($"{branchDeliveries.Sum(p => p.Weight):N0}")</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
<tr class="sum bold">
|
||||
@{
|
||||
var kmw = Elwig.Helpers.Utils.AggregateDeliveryPartsKmw(Model.Deliveries);
|
||||
|
@ -78,6 +78,8 @@ namespace Elwig.Documents {
|
||||
name = "CreditNote";
|
||||
} else if (this is DeliveryJournal) {
|
||||
name = "DeliveryJournal";
|
||||
} else if (this is DeliveryDepreciationList) {
|
||||
name = "DeliveryDepreciationList";
|
||||
} else if (this is Letterhead) {
|
||||
name = "Letterhead";
|
||||
} else if (this is DeliveryConfirmation) {
|
||||
|
@ -24,7 +24,7 @@ namespace Elwig.Services {
|
||||
public static class DeliveryService {
|
||||
|
||||
public enum ExportSubject {
|
||||
FromFilters, FromToday, FromSeasonAndBranch, Selected,
|
||||
FromFilters, FromToday, FromSeason, FromSeasonAndBranch, Selected,
|
||||
};
|
||||
|
||||
public static async Task<Member?> GetMemberAsync(int mgnr) {
|
||||
@ -809,6 +809,71 @@ namespace Elwig.Services {
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
public static async Task GenerateDeliveryDepreciationList(this DeliveryAdminViewModel vm, ExportSubject subject, ExportMode mode) {
|
||||
using var ctx = new AppDbContext();
|
||||
IQueryable<DeliveryPart> query;
|
||||
List<string> filterNames = [];
|
||||
if (subject == ExportSubject.FromFilters) {
|
||||
var (f, _, q, _, _) = await vm.GetFilters(ctx);
|
||||
query = q;
|
||||
filterNames.AddRange(f);
|
||||
} else if (subject == ExportSubject.FromSeason) {
|
||||
var year = vm.FilterSeason ?? Utils.CurrentLastSeason;
|
||||
query = ctx.DeliveryParts
|
||||
.Where(p => p.Year == year);
|
||||
filterNames.Add($"{year}");
|
||||
} else {
|
||||
throw new ArgumentException("Invalid value for ExportSubject");
|
||||
}
|
||||
|
||||
query = query
|
||||
.Where(p => p.QualId == "WEI")
|
||||
.OrderBy(p => p.Delivery.MgNr)
|
||||
.ThenBy(p => p.Delivery.DateString)
|
||||
.ThenBy(p => p.Delivery.TimeString)
|
||||
.ThenBy(p => p.Delivery.LsNr)
|
||||
.ThenBy(p => p.DPNr);
|
||||
filterNames.Remove("abgewertet");
|
||||
|
||||
if (mode == ExportMode.SaveList) {
|
||||
var d = new SaveFileDialog() {
|
||||
FileName = $"{DeliveryDepreciationList.Name}-{vm.FilterSeason ?? Utils.CurrentLastSeason}.ods",
|
||||
DefaultExt = "ods",
|
||||
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
|
||||
Title = $"{DeliveryDepreciationList.Name} speichern unter - Elwig"
|
||||
};
|
||||
if (d.ShowDialog() == true) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
try {
|
||||
using var ods = new OdsFile(d.FileName);
|
||||
var tblTotal = await DeliveryJournalData.FromQuery(query, filterNames);
|
||||
tblTotal.FullName = DeliveryDepreciationList.Name;
|
||||
tblTotal.Name = "Gesamt";
|
||||
await ods.AddTable(tblTotal);
|
||||
foreach (var branch in await ctx.Branches.OrderBy(b => b.Name).ToListAsync()) {
|
||||
var tbl = await DeliveryJournalData.FromQuery(query.Where(p => p.Delivery.ZwstId == branch.ZwstId), filterNames);
|
||||
tbl.FullName = DeliveryDepreciationList.Name;
|
||||
tbl.Name = branch.Name;
|
||||
await ods.AddTable(tbl);
|
||||
}
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
} else {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
try {
|
||||
var data = await DeliveryJournalData.FromQuery(query, filterNames);
|
||||
using var doc = new DeliveryDepreciationList(string.Join(" / ", filterNames), data);
|
||||
await Utils.ExportDocument(doc, mode);
|
||||
} catch (Exception exc) {
|
||||
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddToolTipCell(Grid grid, string text, int row, int col, int colSpan = 1, bool bold = false, bool alignRight = false, bool alignCenter = false) {
|
||||
var tb = new TextBlock() {
|
||||
Text = text,
|
||||
|
@ -120,6 +120,25 @@
|
||||
<MenuItem x:Name="Menu_WineQualityStatistics_ModeKmw1" Header="...nach °KMW aufschlüsseln (ganze)" IsCheckable="True"
|
||||
Click="Menu_WineQualityStatistics_Mode_Click"/>
|
||||
</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"/>
|
||||
<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>
|
||||
<MenuItem Header="BKI">
|
||||
<MenuItem x:Name="Menu_Bki_SaveList" Header="Traubentransportscheinliste speichern..."/>
|
||||
</MenuItem>
|
||||
|
@ -252,6 +252,23 @@ namespace Elwig.Windows {
|
||||
await App.Client.UpdateValues();
|
||||
}
|
||||
|
||||
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 void Menu_Settings_EnableFreeEditing_Checked(object sender, RoutedEventArgs evt) {
|
||||
if (IsEditing || IsCreating) {
|
||||
DateInput.IsReadOnly = false;
|
||||
|
@ -29,9 +29,10 @@ namespace Tests.DocumentTests {
|
||||
Assert.That(text, Contains.Substring("AT81 1234 5678 9012 3457"));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
20201001X001 1 Grüner Veltliner 73 15,0 ungeb.: 3 219 0,5000 - - 1 609,50
|
||||
20201001X003 1 Grüner Veltliner 75 15,4 ungeb.: 2 561 - -
|
||||
20201001X003 2 Grüner Veltliner Kabinett 87 17,6 ungeb.: 3 129 - -
|
||||
20201001X003 3 Grüner Veltliner 79 16,1 ungeb.: 1 280 - -
|
||||
20201001X003 1 Grüner Veltliner abgew. 75 15,4 ungeb.: 2 561 - -
|
||||
20201001X003 2 Grüner Veltliner Kabinett / abgew.
|
||||
87 17,6 ungeb.: 3 129 - -
|
||||
20201001X003 3 Grüner Veltliner abgew. 79 16,1 ungeb.: 1 280 - -
|
||||
20201001X005 1 Welschriesling 84 17,0 ungeb.: 3 192 - -
|
||||
20201001X005 2 Welschriesling 84 17,1 ungeb.: 2 190 - -
|
||||
"""));
|
||||
|
@ -24,10 +24,10 @@ namespace Tests.DocumentTests {
|
||||
Assert.That(text, Contains.Substring($"Wolkersdorf, am {Elwig.Helpers.Utils.Today:dd.MM.yyyy}"));
|
||||
Assert.That(text, Contains.Substring("Anlieferungsbestätigung 2020"));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
20201001X003 2 Grüner Veltliner Kabinett Kabinett 87 17,6 ungeb.: 3 129 3 129 ☑
|
||||
20201001X003 3 Grüner Veltliner Qualitätswein 79 16,1 ungeb.: 1 280 1 280 ☑
|
||||
20201001X003 1 Grüner Veltliner Qualitätswein 75 15,4 ungeb.: 2 561 2 561 ☑
|
||||
20201001X001 1 Grüner Veltliner Qualitätswein 73 15,0 ungeb.: 3 219 3 219 ☑
|
||||
20201001X003 2 Grüner Veltliner Kabinett Wein 87 17,6 ungeb.: 3 129 3 129 ☑
|
||||
20201001X003 3 Grüner Veltliner Wein 79 16,1 ungeb.: 1 280 1 280 ☑
|
||||
20201001X003 1 Grüner Veltliner Wein 75 15,4 ungeb.: 2 561 2 561 ☑
|
||||
20201001X005 2 Welschriesling Kabinett 84 17,1 ungeb.: 2 190 2 190 ☑
|
||||
20201001X005 1 Welschriesling Kabinett 84 17,0 ungeb.: 3 192 3 192 ☑
|
||||
"""));
|
||||
|
32
Tests/DocumentTests/DeliveryDepreciationListTest.cs
Normal file
32
Tests/DocumentTests/DeliveryDepreciationListTest.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Elwig.Documents;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Models.Dtos;
|
||||
|
||||
namespace Tests.DocumentTests {
|
||||
[TestFixture]
|
||||
public class DeliveryDepreciationListTest {
|
||||
|
||||
[Test]
|
||||
public async Task Test_01_DepreciatedDeliveries2020() {
|
||||
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);
|
||||
var text = await Utils.GeneratePdfText(doc, true);
|
||||
var table = Utils.ExtractTable(text);
|
||||
Assert.Multiple(() => {
|
||||
Assert.That(text, Contains.Substring("Abwertungsliste"));
|
||||
Assert.That(text, Contains.Substring("Saison 2020"));
|
||||
Assert.That(table, Is.EqualTo(new string[][] {
|
||||
["101, MUSTERMANN Max", "Teil-Lfrg.:", "3", "81", "16,5", "6 970"],
|
||||
["20201001X003 1 01.10.2020 10:24", "Grüner Veltliner", "75", "15,4", "2 561"],
|
||||
["20201001X003 2 01.10.2020 10:24", "Grüner Veltliner", "Kabinett", "87", "17,6", "3 129"],
|
||||
["20201001X003 3 01.10.2020 10:24", "Grüner Veltliner", "79", "16,1", "1 280"],
|
||||
["103, MUSTERBAUER Matthäus", "Teil-Lfrg.:", "2", "79", "16,2", "6 099"],
|
||||
["20201002X001 1 02.10.2020 09:13", "Grüner Veltliner", "Bio", "80", "16,3", "3 198"],
|
||||
["20201002X002 1 02.10.2020 09:28", "Grüner Veltliner", "Bio", "78", "16,0", "2 901"],
|
||||
["Gesamt:", "(Teil-)Lieferungen: 3 (5)", "80", "16,3", "13 069"],
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -84,20 +84,20 @@ namespace Tests.DocumentTests {
|
||||
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X003"));
|
||||
Assert.That(text, Contains.Substring("Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht"));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
1 Grüner Veltliner Qualitätswein 75 15,4 2 561
|
||||
Herkunft: Österreich / Weinland / Niederösterreich
|
||||
1 Grüner Veltliner Wein 75 15,4 2 561
|
||||
Herkunft: Österreich
|
||||
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
|
||||
Waage: ?, ID: ? (gerebelt gewogen)
|
||||
"""));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
2 Grüner Veltliner Kabinett Kabinett 87 17,6 3 129
|
||||
Herkunft: Österreich / Weinland / Niederösterreich
|
||||
2 Grüner Veltliner Kabinett Wein 87 17,6 3 129
|
||||
Herkunft: Österreich
|
||||
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
|
||||
Waage: ?, ID: ? (gerebelt gewogen)
|
||||
"""));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
3 Grüner Veltliner Qualitätswein 79 16,1 1 280
|
||||
Herkunft: Österreich / Weinland / Niederösterreich
|
||||
3 Grüner Veltliner Wein 79 16,1 1 280
|
||||
Herkunft: Österreich
|
||||
/ Matzner Hügel / Hohenruppersdorf / KG Hohenruppersdorf
|
||||
Waage: ?, ID: ? (gerebelt gewogen)
|
||||
"""));
|
||||
@ -123,9 +123,9 @@ namespace Tests.DocumentTests {
|
||||
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201002X001"));
|
||||
Assert.That(text, Contains.Substring("Das Mitglied erklärt, dass die gelieferte Ware dem österreichischen Weingesetz entspricht"));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
1 Grüner Veltliner Qualitätswein 80 16,3 3 198
|
||||
1 Grüner Veltliner Wein 80 16,3 3 198
|
||||
Bewirtschaftung: Bio (AT-BIO-302)
|
||||
Herkunft: Österreich / Weinland / Niederösterreich
|
||||
Herkunft: Österreich
|
||||
/ Wolkersdorfer Hochleithen / Wolkersdorf im Weinviertel / KG Wolkersdorf
|
||||
Waage: ?, ID: ? (gerebelt gewogen)
|
||||
"""));
|
||||
|
@ -16,14 +16,19 @@ namespace Tests.DocumentTests {
|
||||
Assert.That(text, Contains.Substring("Qualitätsstatistik"));
|
||||
Assert.That(text, Contains.Substring("Saison 2020"));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
Qualitätswein
|
||||
73 2 4 431
|
||||
74 2 4 203
|
||||
75 3 5 176
|
||||
77 1 842
|
||||
Wein
|
||||
75 1 2 561
|
||||
78 1 2 901
|
||||
79 1 1 280
|
||||
80 1 3 198
|
||||
87 1 3 129
|
||||
"""));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
Qualitätswein
|
||||
73 2 4 431
|
||||
74 2 4 203
|
||||
75 2 2 615
|
||||
77 1 842
|
||||
82 1 4 002
|
||||
"""));
|
||||
Assert.That(text, Contains.Substring("""
|
||||
@ -31,14 +36,14 @@ namespace Tests.DocumentTests {
|
||||
84 3 8 960
|
||||
85 3 11 181
|
||||
86 1 2 987
|
||||
87 2 5 002
|
||||
87 1 1 873
|
||||
89 2 4 723
|
||||
"""));
|
||||
Assert.That(text, Contains.Substring(
|
||||
"80 5 " + "13 069 " +
|
||||
"- 0 0 " +
|
||||
"- 0 0 " +
|
||||
"77 12 " + "26 033 " +
|
||||
"86 11 " + "32 853"));
|
||||
"77 5 " + "11 568 " +
|
||||
"85 6 " + "17 561"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -43,17 +43,17 @@ INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw,
|
||||
(2020, 1, 1, 'GV', NULL, NULL, 3219, 15.0, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, '1', '{"id":"321","nr":321,"gross_weight":3219,"tare_weight":0,"net_weight":3219,"date":"2020-10-01","time":"09:02:46"}', NULL),
|
||||
(2020, 2, 1, 'GV', 'K', NULL, 2987, 17.5, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 2, 2, 'GV', 'K', NULL, 1873, 17.7, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 3, 1, 'GV', NULL, NULL, 2561, 15.4, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 3, 2, 'GV', 'K', NULL, 3129, 17.6, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 3, 3, 'GV', NULL, NULL, 1280, 16.1, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 3, 1, 'GV', NULL, NULL, 2561, 15.4, 'WEI', 'OEST', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 3, 2, 'GV', 'K', NULL, 3129, 17.6, 'WEI', 'OEST', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 3, 3, 'GV', NULL, NULL, 1280, 16.1, 'WEI', 'OEST', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 4, 1, 'GV', NULL, NULL, 4002, 16.7, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 4, 2, 'GV', NULL, NULL, 481, 15.3, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 5, 1, 'WR', NULL, NULL, 3192, 17.0, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 5, 2, 'WR', NULL, NULL, 2190, 17.1, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 6, 1, 'GV', NULL, 'B', 1732, 15.2, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 7, 1, 'GV', NULL, 'B', 3198, 16.3, 'QUW', 'WLNO', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 7, 1, 'GV', NULL, 'B', 3198, 16.3, 'WEI', 'OEST', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 7, 2, 'GV', NULL, 'B', 2134, 15.4, 'QUW', 'WLNO', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 8, 1, 'GV', NULL, 'B', 2901, 16.0, 'QUW', 'WLNO', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 8, 1, 'GV', NULL, 'B', 2901, 16.0, 'WEI', 'OEST', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 8, 2, 'GV', NULL, 'B', 3321, 17.3, 'KAB', 'WLNO', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 9, 1, 'WR', NULL, 'B', 3998, 17.2, 'KAB', 'WLNO', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
(2020, 10, 1, 'ZW', NULL, NULL, 1212, 15.0, 'QUW', 'WLNO', 15224, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||
|
Reference in New Issue
Block a user