Elwig: Rename (wine) variant to variety
This commit is contained in:
@ -55,13 +55,13 @@ namespace Elwig.Documents {
|
||||
CurrencySymbol = season.Currency.Symbol ?? season.Currency.Code;
|
||||
Precision = season.Precision;
|
||||
|
||||
var variants = ctx.WineVarieties.ToDictionary(v => v.SortId, v => v);
|
||||
var varieties = ctx.WineVarieties.ToDictionary(v => v.SortId, v => v);
|
||||
var attributes = ctx.WineAttributes.ToDictionary(a => a.AttrId, a => a);
|
||||
var comTypes = ctx.AreaCommitmentTypes.ToDictionary(t => t.VtrgId, t => t);
|
||||
MemberUnderDeliveries = underDeliveries?
|
||||
.OrderBy(u => u.Key)
|
||||
.Select(u => (
|
||||
variants[u.Key[..2]].Name + (u.Key.Length > 2 ? " " + attributes[u.Key[2..]].Name : ""),
|
||||
varieties[u.Key[..2]].Name + (u.Key.Length > 2 ? " " + attributes[u.Key[2..]].Name : ""),
|
||||
u.Value.Diff,
|
||||
u.Value.Diff * (comTypes[u.Key].PenaltyPerKg ?? 0)
|
||||
- (comTypes[u.Key].PenaltyAmount ?? 0)
|
||||
|
@ -49,7 +49,7 @@
|
||||
@if (i == 0) {
|
||||
<td rowspan="@rows">@p.LsNr</td>
|
||||
<td rowspan="@rows">@p.DPNr</td>
|
||||
<td class="small">@p.Variant</td>
|
||||
<td class="small">@p.Variety</td>
|
||||
<td class="small">@p.Attribute</td>
|
||||
<td rowspan="@rows" class="center">@($"{p.Gradation.Oe:N0}")</td>
|
||||
<td rowspan="@rows" class="center">@($"{p.Gradation.Kmw:N1}")</td>
|
||||
|
@ -42,17 +42,17 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
var lastVariant = "";
|
||||
var lastVariety = "";
|
||||
}
|
||||
@foreach (var p in Model.Data.Rows) {
|
||||
var rows = Math.Max(p.Buckets.Length, p.Modifiers.Length + 1);
|
||||
var first = true;
|
||||
@for (int i = 0; i < rows; i++) {
|
||||
<tr class="@(first ? "first" : "") @(p.Variant != lastVariant && lastVariant != "" ? "new": "") @(rows > i + 1 ? "last" : "")">
|
||||
<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 class="small">@p.Variant</td>
|
||||
<td class="small">@p.Variety</td>
|
||||
<td class="small">@p.Attribute</td>
|
||||
<td class="small">@p.QualityLevel</td>
|
||||
<td rowspan="@rows" class="center">@($"{p.Gradation.Oe:N0}")</td>
|
||||
@ -80,7 +80,7 @@
|
||||
first = false;
|
||||
}
|
||||
</tr>
|
||||
lastVariant = p.Variant;
|
||||
lastVariety = p.Variety;
|
||||
}
|
||||
}
|
||||
<tr class="sum bold">
|
||||
|
@ -19,7 +19,7 @@ namespace Elwig.Documents {
|
||||
public DeliveryJournal(string filter, IQueryable<DeliveryPart> deliveries) :
|
||||
this(filter, deliveries
|
||||
.Include(p => p.Delivery).ThenInclude(d => d.Member)
|
||||
.Include(p => p.Variant)
|
||||
.Include(p => p.Variety)
|
||||
.ToList()) { }
|
||||
|
||||
public DeliveryJournal(AppDbContext ctx, DateOnly date) :
|
||||
|
@ -45,7 +45,7 @@
|
||||
<td class="small">@($"{p.Delivery.Time:HH:mm}")</td>
|
||||
<td class="number">@p.Delivery.Member.MgNr</td>
|
||||
<td class="small">@p.Delivery.Member.AdministrativeName</td>
|
||||
<td class="small">@p.Variant.Name</td>
|
||||
<td class="small">@p.Variety.Name</td>
|
||||
<td class="center">@($"{p.Oe:N0}")</td>
|
||||
<td class="center">@($"{p.Kmw:N1}")</td>
|
||||
<td class="number">@($"{p.Weight:N0}")</td>
|
||||
|
@ -36,7 +36,7 @@
|
||||
@foreach (var part in Model.Delivery.Parts.OrderBy(p => p.DPNr)) {
|
||||
<tr class="main">
|
||||
<td class="center">@part.DPNr</td>
|
||||
<td colspan="2">@part.Variant.Name</td>
|
||||
<td colspan="2">@part.Variety.Name</td>
|
||||
<td colspan="2">@part.Attribute?.Name</td>
|
||||
<td>@part.Quality.Name</td>
|
||||
<td class="center">@($"{part.Oe:N0}")</td>
|
||||
|
@ -163,10 +163,10 @@ namespace Elwig.Helpers.Billing {
|
||||
dict = [];
|
||||
}
|
||||
|
||||
var variants = data.Where(p => !p.Key.StartsWith('/') && p.Key.Length == 2);
|
||||
var varieties = data.Where(p => !p.Key.StartsWith('/') && p.Key.Length == 2);
|
||||
var attributes = data.Where(p => p.Key.StartsWith('/'));
|
||||
var others = data.Where(p => !p.Key.StartsWith('/') && p.Key.Length > 2 && p.Key != "default");
|
||||
foreach (var (idx, v) in variants) {
|
||||
foreach (var (idx, v) in varieties) {
|
||||
var curve = v?.AsValue() ?? throw new InvalidOperationException();
|
||||
foreach (var i in vaributes.Where(e => e.StartsWith(idx[..^1]))) {
|
||||
dict[i] = curve;
|
||||
|
@ -70,7 +70,11 @@ namespace Elwig.Helpers.Billing {
|
||||
return (curves, dict3);
|
||||
}
|
||||
|
||||
private static List<GraphEntry> CreateGraphEntries(AppDbContext ctx, int precision, Dictionary<int, Curve> curves, Dictionary<int, List<string>> entries) {
|
||||
private static List<GraphEntry> CreateGraphEntries(
|
||||
AppDbContext ctx, int precision,
|
||||
Dictionary<int, Curve> curves,
|
||||
Dictionary<int, List<string>> entries
|
||||
) {
|
||||
var vars = ctx.WineVarieties.ToDictionary(v => v.SortId, v => v);
|
||||
var attrs = ctx.WineAttributes.ToDictionary(a => a.AttrId, a => a);
|
||||
return entries
|
||||
|
@ -4,8 +4,8 @@ using System;
|
||||
namespace Elwig.Helpers.Billing {
|
||||
public class Varibute : IComparable<Varibute> {
|
||||
|
||||
public WineVar? Variety { get; }
|
||||
public WineAttr? Attribute { get; }
|
||||
public readonly WineVar? Variety;
|
||||
public readonly WineAttr? Attribute;
|
||||
public string Listing => $"{Variety?.SortId}{Attribute?.AttrId}";
|
||||
public string FullName => $"{Variety?.Name}" + (Variety != null && Attribute != null ? " " : "") + $"{Attribute?.Name}";
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Helpers.Billing;
|
||||
using Elwig.Models.Entities;
|
||||
using Elwig.Models.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
@ -46,7 +43,7 @@ namespace Elwig.Models.Dtos {
|
||||
return await table.FromSqlRaw($"""
|
||||
SELECT d.year, c.tgnr, v.avnr, d.mgnr, d.did, d.lsnr, d.dpnr, d.weight, d.modifiers,
|
||||
b.bktnr, d.sortid, b.discr, b.value, pb.price, pb.amount, p.net_amount, p.amount AS total_amount,
|
||||
s.name AS variant, a.name AS attribute, q.name AS quality_level, d.oe, d.kmw
|
||||
s.name AS variety, a.name AS attribute, q.name AS quality_level, d.oe, d.kmw
|
||||
FROM v_delivery d
|
||||
JOIN wine_variety s ON s.sortid = d.sortid
|
||||
LEFT JOIN wine_attribute a ON a.attrid = d.attrid
|
||||
@ -71,7 +68,7 @@ namespace Elwig.Models.Dtos {
|
||||
|
||||
public string LsNr;
|
||||
public int DPNr;
|
||||
public string Variant;
|
||||
public string Variety;
|
||||
public string? Attribute;
|
||||
public string[] Modifiers;
|
||||
public string QualityLevel;
|
||||
@ -89,7 +86,7 @@ namespace Elwig.Models.Dtos {
|
||||
|
||||
LsNr = f.LsNr;
|
||||
DPNr = f.DPNr;
|
||||
Variant = f.Variant;
|
||||
Variety = f.Variety;
|
||||
Attribute = f.Attribute;
|
||||
var modifiers = (IEnumerable<Modifier>)(f.Modifiers ?? "").Split(',')
|
||||
.Select(m => season?.Modifiers.FirstOrDefault(s => s.ModId == m))
|
||||
@ -148,8 +145,8 @@ namespace Elwig.Models.Dtos {
|
||||
public long? NetAmount { get; set; }
|
||||
[Column("total_amount")]
|
||||
public long? TotalAmount { get; set; }
|
||||
[Column("variant")]
|
||||
public string Variant { get; set; }
|
||||
[Column("variety")]
|
||||
public string Variety { get; set; }
|
||||
[Column("attribute")]
|
||||
public string? Attribute { get; set; }
|
||||
[Column("quality_level")]
|
||||
|
@ -10,7 +10,7 @@ namespace Elwig.Models.Dtos {
|
||||
private static readonly (string, string, string?, int)[] FieldNames = new[] {
|
||||
("LsNr", "LsNr.", null, 26),
|
||||
("DPNr", "Pos.", null, 8),
|
||||
("Variant", "Sorte", null, 40),
|
||||
("Variety", "Sorte", null, 40),
|
||||
("Attribute", "Attribut", null, 20),
|
||||
("Modifiers", "Zu-/Abschläge", null, 30),
|
||||
("QualityLevel", "Qualitätsstufe", null, 25),
|
||||
@ -51,7 +51,7 @@ namespace Elwig.Models.Dtos {
|
||||
if (mgnr != null) q = q.Where(p => p.Delivery.MgNr == mgnr);
|
||||
await q
|
||||
.Include(p => p.Delivery)
|
||||
.Include(p => p.Variant)
|
||||
.Include(p => p.Variety)
|
||||
.Include(p => p.Attribute)
|
||||
.Include(p => p.Quality)
|
||||
.Include(p => p.Buckets)
|
||||
@ -71,7 +71,7 @@ namespace Elwig.Models.Dtos {
|
||||
public class DeliveryConfirmationRow {
|
||||
public string LsNr;
|
||||
public int DPNr;
|
||||
public string Variant;
|
||||
public string Variety;
|
||||
public string? Attribute;
|
||||
public string QualityLevel;
|
||||
public (double Oe, double Kmw) Gradation;
|
||||
@ -83,7 +83,7 @@ namespace Elwig.Models.Dtos {
|
||||
var d = p.Delivery;
|
||||
LsNr = d.LsNr;
|
||||
DPNr = p.DPNr;
|
||||
Variant = p.Variant.Name;
|
||||
Variety = p.Variety.Name;
|
||||
Attribute = p.Attribute?.Name;
|
||||
QualityLevel = p.Quality.Name;
|
||||
Gradation = (p.Oe, p.Kmw);
|
||||
|
@ -23,7 +23,7 @@ namespace Elwig.Models.Entities {
|
||||
public string SortId { get; set; }
|
||||
|
||||
[ForeignKey("SortId")]
|
||||
public virtual WineVar Variant { get; private set; }
|
||||
public virtual WineVar Variety { get; private set; }
|
||||
|
||||
[Column("attrid")]
|
||||
public string? AttrId { get; set; }
|
||||
|
Reference in New Issue
Block a user