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
+2 -2
View File
@@ -77,13 +77,13 @@ namespace Elwig.Documents {
.AddCell(NewAsideCell("Betr.-Nr.:", 6, isName: true)).AddCell(NewAsideCell(Member.LfbisNr ?? "-", 6, right: true, center: Member.LfbisNr == null))
.AddCell(NewAsideCell("OOC-ID:", 6, isName: true)).AddCell(NewAsideCell(Member.OrganicOperatorId ?? "-", 8, right: true, center: Member.OrganicOperatorId == null))
.AddCell(NewAsideCell("UID:", 6, isName: true)).AddCell(NewAsideCell(Member.UstIdNr ?? "-", 10, right: true, center: Member.UstIdNr == null))
.AddCell(NewAsideCell(new KernedParagraph("", 10).Add(Italic(Member.IsBuchführend ? "(buchführend)" : "(pauschaliert)")), 10, center: true));
.AddCell(NewAsideCell(new KernedParagraph("", 10).Add(Italic(Member.IsAccounting ? "(buchführend)" : "(pauschaliert)")), 10, center: true));
} else {
Aside
.AddCell(NewAsideCell("Mitglieds-Nr.:", 12, isName: true)).AddCell(NewAsideCell($"{Member.MgNr}", 4, right: true)).AddCell(NewAsideCell("", 10))
.AddCell(NewAsideCell("Betriebs-Nr.:", 10, isName: true)).AddCell(NewAsideCell(Member.LfbisNr ?? "-", 6, right: true, center: Member.LfbisNr == null)).AddCell(NewAsideCell("", 10))
.AddCell(NewAsideCell("UID:", 6, isName: true)).AddCell(NewAsideCell(Member.UstIdNr ?? "-", 10, right: true, center: Member.UstIdNr == null))
.AddCell(NewAsideCell(new KernedParagraph("", 10).Add(Italic(Member.IsBuchführend ? "(buchführend)" : "(pauschaliert)")), 10, center: true));
.AddCell(NewAsideCell(new KernedParagraph("", 10).Add(Italic(Member.IsAccounting ? "(buchführend)" : "(pauschaliert)")), 10, center: true));
}
}
+4 -4
View File
@@ -158,8 +158,8 @@ namespace Elwig.Documents {
.AddCell(NewDataTh("Betriebs-Nr.:")).AddCell(NewTd(Member.LfbisNr))
.AddCell(NewDataTh("UID:", colspan: 2)).AddCell(NewTd(Member.UstIdNr, colspan: 2))
.AddCell(NewDataTh("Stammgemeinde:")).AddCell(NewTd(Member.DefaultKg?.Name))
.AddCell(NewDataTh("Buchführend:", colspan: 2)).AddCell(NewTd(new KernedParagraph(Member.IsBuchführend ? "Ja " : "Nein ", 10)
.Add(Normal($"({(Member.IsBuchführend ? season.VatNormal : season.VatFlatrate) * 100:N0}% USt.)", 8)), colspan: 2))
.AddCell(NewDataTh("Buchführend:", colspan: 2)).AddCell(NewTd(new KernedParagraph(Member.IsAccounting ? "Ja " : "Nein ", 10)
.Add(Normal($"({(Member.IsAccounting ? season.VatNormal : season.VatFlatrate) * 100:N0}% USt.)", 8)), colspan: 2))
.AddCell(NewDataTh("(Katastralgemeinde mit dem größten Anteil an Weinbauflächen)", 8, colspan: 2))
.AddCell(NewDataTh("Bio:", colspan: 2)).AddCell(NewTd(new KernedParagraph(Member.IsOrganic ? "Ja" : "Nein", 10)
.Add(Normal(Member.OrganicAuthorityCode != null || Member.OrganicOperatorId != null ? $" ({Member.OrganicAuthorityCode}{(Member.OrganicAuthorityCode != null && Member.OrganicOperatorId != null ? ", " : "")}{Member.OrganicOperatorId})" : "", 8)), colspan: 2))
@@ -168,11 +168,11 @@ namespace Elwig.Documents {
.Add(Normal("(" + (Member.ExitDate != null ? $"{Member.EntryDate:dd.MM.yyyy}\u2013{Member.ExitDate:dd.MM.yyyy}" : $"seit {Member.EntryDate:dd.MM.yyyy}") + ")", 8))))
.AddCell(NewDataTh("Geschäftsanteile:", colspan: 2)).AddCell(NewTd(shares, colspan: 2))
.AddCell(NewDataTh("Stamm-Zweigstelle:")).AddCell(NewTd(Member.Branch?.Name))
.AddCell(NewDataTh("Volllieferant:", colspan: 2)).AddCell(NewTd(Member.IsVollLieferant ? "Ja" : "Nein", colspan: 2))
.AddCell(NewDataTh("Vollablieferer:", colspan: 2)).AddCell(NewTd(Member.IsFullDelivery ? "Ja" : "Nein", colspan: 2))
.AddCell(NewDataTh("Zusendungen per\u2026")).AddCell(NewTd(new KernedParagraph(10)
.Add(Italic("Post:")).Add(Normal(Member.ContactViaPost ? " Ja \u2013 " : " Nein \u2013 "))
.Add(Italic("E-Mail:")).Add(Normal(Member.ContactViaEmail ? " Ja" : " Nein"))))
.AddCell(NewDataTh("Funktionär:", colspan: 2)).AddCell(NewTd(Member.IsFunktionär ? "Ja" : "Nein", colspan: 2));
.AddCell(NewDataTh("Funktionär:", colspan: 2)).AddCell(NewTd(Member.IsOfficer ? "Ja" : "Nein", colspan: 2));
return tbl;
}
+22 -22
View File
@@ -108,16 +108,16 @@ namespace Elwig.Documents {
var totalSum = _credits.Sum(p => p.Amount);
var weiRows = data.Rows.Where(r => r.QualityLevel == "Wein");
var minWei = weiRows.Min(r => r.Ungeb.MinPrice);
var maxWei = weiRows.Max(r => r.Ungeb.MaxPrice);
var minWei = weiRows.Min(r => r.UnCtrd.MinPrice);
var maxWei = weiRows.Max(r => r.UnCtrd.MaxPrice);
var quwRows = data.Rows.Where(r => r.QualityLevel != "Wein");
var minPrice = quwRows.Min(r => r.Ungeb.MinPrice);
var maxPrice = quwRows.Max(r => r.Ungeb.MaxPrice);
var gebRows = data.Rows
.Where(r => r.Geb.MaxPrice != null && r.Ungeb.MinPrice != null)
.Select(r => r.Geb.MaxPrice - r.Ungeb.MinPrice);
var minGeb = gebRows.Min();
var maxGeb = gebRows.Max();
var minPrice = quwRows.Min(r => r.UnCtrd.MinPrice);
var maxPrice = quwRows.Max(r => r.UnCtrd.MaxPrice);
var ctrdRows = data.Rows
.Where(r => r.Ctrd.MaxPrice != null && r.UnCtrd.MinPrice != null)
.Select(r => r.Ctrd.MaxPrice - r.UnCtrd.MinPrice);
var minCtrd = ctrdRows.Min();
var maxCtrd = ctrdRows.Max();
tbl.AddCell(NewSectionHdr("Allgemein", colspan: 5))
.AddCell(NewSectionHdr("Berücksichtigt", colspan: 3, borderLeft: true))
@@ -197,7 +197,7 @@ namespace Elwig.Documents {
.AddCell(NewTd(CurrencySymbol))
.AddCell(NewTd($"{Math.Abs(vat):N2}", right: true))
.AddCell(NewSectionTh("Gebunden-Zuschlag:", borderLeft: true))
.AddCell(NewTd(minGeb == null && maxGeb == null ? "-" : minGeb != maxGeb ? $"{minGeb:N4}\u2013{maxGeb:N4} {CurrencySymbol}/kg" : minGeb == 0 ? "-" : $"{minGeb:N4} {CurrencySymbol}/kg", colspan: 2, center: true))
.AddCell(NewTd(minCtrd == null && maxCtrd == null ? "-" : minCtrd != maxCtrd ? $"{minCtrd:N4}\u2013{maxCtrd:N4} {CurrencySymbol}/kg" : minCtrd == 0 ? "-" : $"{minCtrd:N4} {CurrencySymbol}/kg", colspan: 2, center: true))
.AddCell(NewSectionTh("Bruttosumme:", colspan: 2))
.AddCell(NewTd(borderTop: true))
@@ -211,21 +211,21 @@ namespace Elwig.Documents {
.AddCell(NewTd(CurrencySymbol))
.AddCell(NewTd($"{Math.Abs(totalMods):N2}", right: true))
.AddCell(NewSectionTh("Menge (ungebunden):", borderLeft: true, borderTop: true))
.AddCell(NewTd($"{data.Rows.Sum(r => r.Ungeb.Weight):N0} kg", colspan: 2, right: true, borderTop: true))
.AddCell(NewTd($"{data.Rows.Sum(r => r.UnCtrd.Weight):N0} kg", colspan: 2, right: true, borderTop: true))
.AddCell(NewSectionTh("Bereits berücksichtigte Abzüge:", colspan: 2))
.AddCell(NewTd(Utils.GetSign(considered)))
.AddCell(NewTd(CurrencySymbol))
.AddCell(NewTd($"{Math.Abs(considered):N2}", right: true))
.AddCell(NewSectionTh("Menge (gebunden):", borderLeft: true))
.AddCell(NewTd($"{data.Rows.Sum(r => r.Geb.Weight + r.LowGeb.Weight):N0} kg", colspan: 2, right: true))
.AddCell(NewTd($"{data.Rows.Sum(r => r.Ctrd.Weight + r.LowCtrd.Weight):N0} kg", colspan: 2, right: true))
.AddCell(NewSectionTh("Auszahlungsbetrag:", colspan: 2))
.AddCell(NewTd(borderTop: true))
.AddCell(NewTd(CurrencySymbol, borderTop: true))
.AddCell(NewTd($"{totalSum:N2}", right: true, borderTop: true))
.AddCell(NewSectionTh("Gesamtmenge:", borderLeft: true))
.AddCell(NewTd($"{data.Rows.Sum(r => r.Ungeb.Weight + r.LowGeb.Weight + r.Geb.Weight):N0} kg", colspan: 2, right: true, borderTop: true));
.AddCell(NewTd($"{data.Rows.Sum(r => r.UnCtrd.Weight + r.LowCtrd.Weight + r.Ctrd.Weight):N0} kg", colspan: 2, right: true, borderTop: true));
return tbl;
}
@@ -290,22 +290,22 @@ namespace Elwig.Documents {
.ToList();
var border = lastHdr != null;
tbl.AddCell(NewTd(hdr, colspan: 2, bold: true, italic: true, borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.Ungeb.Weight):N0}", right: true, bold: true, borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.UnCtrd.Weight):N0}", right: true, bold: true, borderTop: border))
.AddCell(NewTd(borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.LowGeb.Weight):N0}", right: true, bold: true, borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.LowCtrd.Weight):N0}", right: true, bold: true, borderTop: border))
.AddCell(NewTd(borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.Geb.Weight):N0}", right: true, bold: true, borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.Ctrd.Weight):N0}", right: true, bold: true, borderTop: border))
.AddCell(NewTd(borderTop: border))
.AddCell(NewTd($"{rows.Sum(r => r.Amount):N2}", right: true, bold: true, borderTop: border));
}
tbl.AddCell(NewTd(row.QualityLevel))
.AddCell(NewTd($"{row.Oe:N0}", center: true))
.AddCell(NewTd(row.Ungeb.Weight != 0 ? $"{row.Ungeb.Weight:N0}" : "-", right: true))
.AddCell(NewTd(row.Ungeb.MaxPrice != null ? $"{row.Ungeb.MaxPrice:N4}" : "-", right: true))
.AddCell(NewTd(row.LowGeb.Weight != 0 ? $"{row.LowGeb.Weight:N0}" : "-", right: true))
.AddCell(NewTd(row.LowGeb.MaxPrice != null ? $"{row.LowGeb.MaxPrice:N4}" : "-", right: true))
.AddCell(NewTd(row.Geb.Weight != 0 ? $"{row.Geb.Weight:N0}" : "-", right: true))
.AddCell(NewTd(row.Geb.MaxPrice != null ? $"{row.Geb.MaxPrice:N4}" : "-", right: true))
.AddCell(NewTd(row.UnCtrd.Weight != 0 ? $"{row.UnCtrd.Weight:N0}" : "-", right: true))
.AddCell(NewTd(row.UnCtrd.MaxPrice != null ? $"{row.UnCtrd.MaxPrice:N4}" : "-", right: true))
.AddCell(NewTd(row.LowCtrd.Weight != 0 ? $"{row.LowCtrd.Weight:N0}" : "-", right: true))
.AddCell(NewTd(row.LowCtrd.MaxPrice != null ? $"{row.LowCtrd.MaxPrice:N4}" : "-", right: true))
.AddCell(NewTd(row.Ctrd.Weight != 0 ? $"{row.Ctrd.Weight:N0}" : "-", right: true))
.AddCell(NewTd(row.Ctrd.MaxPrice != null ? $"{row.Ctrd.MaxPrice:N4}" : "-", right: true))
.AddCell(NewTd($"{row.Amount:N2}", right: true));
lastHdr = hdr;
}
+6 -6
View File
@@ -77,13 +77,13 @@ namespace Elwig.Helpers.Billing {
}
public async Task CalculateBuckets(
bool? honorGebundenField = null,
bool? honorContractedField = null,
bool? allowAttributesIntoLower = null,
bool? avoidUnderDeliveries = null,
SqliteConnection? cnx = null
) {
using var ctx = new AppDbContext();
var honorGebunden = honorGebundenField ?? Season.Billing_HonorGebunden;
var honorContracted = honorContractedField ?? Season.Billing_HonorContracted;
var allowAttrsIntoLower = allowAttributesIntoLower ?? Season.Billing_AllowAttrsIntoLower;
var avoidUnderDlvrs = avoidUnderDeliveries ?? Season.Billing_AvoidUnderDeliveries;
var attrVals = ctx.WineAttributes.ToDictionary(a => a.AttrId, a => (a.IsStrict, a.FillLower));
@@ -96,10 +96,10 @@ namespace Elwig.Helpers.Billing {
var deliveries = new List<(int, int, int, string, int, double, string, string?, string[], bool?)>();
using (var cmd = cnx.CreateCommand()) {
cmd.CommandText = $"""
SELECT mgnr, did, dpnr, sortid, weight, kmw, qualid, attrid, modifiers, gebunden
SELECT mgnr, did, dpnr, sortid, weight, kmw, qualid, attrid, modifiers, contracted
FROM v_delivery
WHERE year = {Year}
ORDER BY mgnr, sortid, abgewertet ASC, {(honorGebunden ? "gebunden IS NOT NULL DESC, gebunden DESC," : "")}
ORDER BY mgnr, sortid, abgewertet ASC, {(honorContracted ? "contracted IS NOT NULL DESC, contracted DESC," : "")}
attribute_prio DESC, COALESCE(attrid, '~'), kmw DESC, lsnr, dpnr
""";
using var reader = await cmd.ExecuteReaderAsync();
@@ -117,12 +117,12 @@ namespace Elwig.Helpers.Billing {
int lastMgNr = 0;
Dictionary<string, AreaComBucket>? rightsAndObligations = null;
Dictionary<string, int> used = [];
foreach (var (mgnr, did, dpnr, sortid, weight, kmw, qualid, attrid, modifiers, gebunden) in deliveries) {
foreach (var (mgnr, did, dpnr, sortid, weight, kmw, qualid, attrid, modifiers, contracted) in deliveries) {
if (lastMgNr != mgnr) {
rightsAndObligations = await ctx.GetMemberAreaCommitmentBuckets(Year, mgnr);
used = [];
}
if ((honorGebunden && gebunden == false) ||
if ((honorContracted && contracted == false) ||
rightsAndObligations == null || rightsAndObligations.Count == 0 ||
qualid == "WEI" || qualid == "RSW" || qualid == "LDW")
{
+10 -10
View File
@@ -14,7 +14,7 @@ namespace Elwig.Helpers.Billing {
public enum CalculationMode { Elwig, WgMaster }
public enum CurveMode { Oe, Kmw }
public record struct Curve(CurveMode Mode, Dictionary<double, decimal> Normal, Dictionary<double, decimal>? Gebunden);
public record struct Curve(CurveMode Mode, Dictionary<double, decimal> Normal, Dictionary<double, decimal>? Contracted);
public static JsonSchema? Schema { get; private set; }
@@ -179,10 +179,10 @@ namespace Elwig.Helpers.Billing {
} else {
throw new InvalidOperationException();
}
var geb = obj["geb"];
if (geb is JsonObject) {
c2 = GetCurveData(geb.AsObject(), cMode);
} else if (geb?.AsValue().TryGetValue(out decimal v) == true) {
var ctrd = obj["ctrd"] ?? obj["geb"];
if (ctrd is JsonObject) {
c2 = GetCurveData(ctrd.AsObject(), cMode);
} else if (ctrd?.AsValue().TryGetValue(out decimal v) == true) {
var splitVal = GetCurveValueAt(c1, quw);
c2 = c1.ToDictionary(e => e.Key, e => e.Value + (e.Key >= quw ? v : 0));
c2[quw] = splitVal + v;
@@ -274,7 +274,7 @@ namespace Elwig.Helpers.Billing {
protected static JsonNode GraphEntryToJson(GraphEntry entry) {
try {
if (entry.GebundenFlatBonus == null) {
if (entry.ContractedFlatBonus == null) {
return JsonValue.Create((decimal)entry.DataGraph.DataY.Distinct().Single());
}
} catch { }
@@ -286,10 +286,10 @@ namespace Elwig.Helpers.Billing {
curve["data"] = GraphToJson(entry.DataGraph, entry.Mode.ToString().ToLower());
if (entry.GebundenFlatBonus != null) {
curve["geb"] = (decimal)entry.GebundenFlatBonus;
} else if (entry.GebundenGraph != null) {
curve["geb"] = GraphToJson(entry.GebundenGraph, entry.Mode.ToString().ToLower());
if (entry.ContractedFlatBonus != null) {
curve["ctrd"] = (decimal)entry.ContractedFlatBonus;
} else if (entry.ContractedGraph != null) {
curve["ctrd"] = GraphToJson(entry.ContractedGraph, entry.Mode.ToString().ToLower());
}
return curve;
+6 -6
View File
@@ -37,11 +37,11 @@ namespace Elwig.Helpers.Billing {
return new BillingVariant(year, avnr, season, attributes, modifiers, areaComTypes, paymentVar, data);
}
public async Task Calculate(bool strictPrices = true, bool? honorGebunden = null, bool? allowAttrsIntoLower = null, bool? avoidUnderDeliveries = null) {
public async Task Calculate(bool strictPrices = true, bool? honorContracted = null, bool? allowAttrsIntoLower = null, bool? avoidUnderDeliveries = null) {
if (PaymentVariant == null || Data == null) throw new Exception("Call Load before Calculate");
using var cnx = await AppDbContext.ConnectAsync();
using var tx = await cnx.BeginTransactionAsync();
await CalculateBuckets(honorGebunden, allowAttrsIntoLower, avoidUnderDeliveries, cnx);
await CalculateBuckets(honorContracted, allowAttrsIntoLower, avoidUnderDeliveries, cnx);
await DeleteInDb(cnx);
await SetCalcTime(cnx);
KeyNotFoundException? exception = null;
@@ -73,7 +73,7 @@ namespace Elwig.Helpers.Billing {
v.avnr,
ROUND(p.amount / POW(10, s.precision - 2)) AS net_amount,
IIF(lc.amount < 0, 0, ROUND(lp.amount / POW(10, s.precision - 2))) AS prev_net_amount,
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
IIF(m.accounting, s.vat_normal, s.vat_flatrate) AS vat,
ROUND(IIF({Data.ConsiderTotalPenalty}, COALESCE(b.total_penalty, 0), 0) / POW(10, s.precision - 2)) +
ROUND(IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0), 0) / POW(10, 4 - 2)) +
ROUND(IIF({Data.ConsiderAutoBusinessShares}, -COALESCE(a.total_amount, 0), 0)) +
@@ -195,13 +195,13 @@ namespace Elwig.Helpers.Billing {
foreach (var part in parts) {
if (part.Value == 0)
continue;
var ungeb = part.Discr == "_";
var unctrd = part.Discr == "_";
var payAttrId = (part.Discr is "" or "_") ? null : part.Discr;
var attrId = part.AttrAreaCom ? payAttrId : part.AttrId;
var geb = !ungeb && (payAttrId == attrId || !part.AttrAreaCom);
var ctrd = !unctrd && (payAttrId == attrId || !part.AttrAreaCom);
decimal price = 0;
try {
price = Data.CalculatePrice(part.SortId, attrId, part.CultId, part.QualId, geb, part.Oe, part.Kmw);
price = Data.CalculatePrice(part.SortId, attrId, part.CultId, part.QualId, ctrd, part.Oe, part.Kmw);
} catch (KeyNotFoundException e) {
invalid.Add(e.Message.Split('\'')[1]);
}
+17 -17
View File
@@ -7,7 +7,7 @@ namespace Elwig.Helpers.Billing {
public class GraphEntry {
public const int MinX = 50;
public const int MinXGeb = 73;
public const int MinXCtrd = 73;
public const int MaxX = 120;
public int Id { get; set; }
@@ -15,11 +15,11 @@ namespace Elwig.Helpers.Billing {
public bool Abgewertet { get; set; }
public Graph DataGraph { get; set; }
public Graph? GebundenGraph { get; set; }
public double? GebundenFlatBonus {
public Graph? ContractedGraph { get; set; }
public double? ContractedFlatBonus {
get {
try {
var val = GebundenGraph?.DataX.Zip(GebundenGraph.DataY)
var val = ContractedGraph?.DataX.Zip(ContractedGraph.DataY)
.Select(e => Math.Round(e.Second - DataGraph.GetPriceAtOe(e.First), Precision))
.Distinct()
.Single();
@@ -30,10 +30,10 @@ namespace Elwig.Helpers.Billing {
}
set {
if (value is not double v) return;
var values = Enumerable.Range(MinXGeb, MaxX - MinXGeb + 1)
var values = Enumerable.Range(MinXCtrd, MaxX - MinXCtrd + 1)
.Select(i => Math.Round(DataGraph.GetPriceAtOe(i) + v, Precision))
.ToArray();
GebundenGraph = new Graph(values, Precision, MinXGeb, MaxX);
ContractedGraph = new Graph(values, Precision, MinXCtrd, MaxX);
}
}
@@ -52,39 +52,39 @@ namespace Elwig.Helpers.Billing {
Vaributes = [];
}
public GraphEntry(int id, int precision, BillingData.CurveMode mode, Dictionary<double, decimal> data, Dictionary<double, decimal>? gebunden) :
public GraphEntry(int id, int precision, BillingData.CurveMode mode, Dictionary<double, decimal> data, Dictionary<double, decimal>? contracted) :
this(id, precision, mode) {
DataGraph = new Graph(data, precision, MinX, MaxX);
if (gebunden != null) GebundenGraph = new Graph(gebunden, precision, MinXGeb, MaxX);
if (contracted != null) ContractedGraph = new Graph(contracted, precision, MinXCtrd, MaxX);
}
public GraphEntry(int id, int precision, BillingData.Curve curve, List<Varibute> vaributes) :
this(id, precision, curve.Mode) {
DataGraph = new Graph(curve.Normal, precision, MinX, MaxX);
if (curve.Gebunden != null)
GebundenGraph = new Graph(curve.Gebunden, precision, MinXGeb, MaxX);
if (curve.Contracted != null)
ContractedGraph = new Graph(curve.Contracted, precision, MinXCtrd, MaxX);
Vaributes = vaributes;
}
private GraphEntry(int id, int precision, BillingData.CurveMode mode, Graph dataGraph, Graph? gebundenGraph, List<Varibute> vaributes) {
private GraphEntry(int id, int precision, BillingData.CurveMode mode, Graph dataGraph, Graph? contractedGraph, List<Varibute> vaributes) {
Id = id;
Precision = precision;
Mode = mode;
DataGraph = dataGraph;
GebundenGraph = gebundenGraph;
ContractedGraph = contractedGraph;
Vaributes = vaributes;
}
public void AddGebundenGraph() {
GebundenGraph ??= new Graph(Precision, MinXGeb, MaxX);
public void AddContractedGraph() {
ContractedGraph ??= new Graph(Precision, MinXCtrd, MaxX);
}
public void RemoveGebundenGraph() {
GebundenGraph = null;
public void RemoveContractedGraph() {
ContractedGraph = null;
}
public GraphEntry Copy(int id) {
return new GraphEntry(id, Precision, Mode, (Graph)DataGraph.Clone(), (Graph?)GebundenGraph?.Clone(), []);
return new GraphEntry(id, Precision, Mode, (Graph)DataGraph.Clone(), (Graph?)ContractedGraph?.Clone(), []);
}
}
}
+2 -2
View File
@@ -45,9 +45,9 @@ namespace Elwig.Helpers.Billing {
return dict;
}
public decimal CalculatePrice(string sortid, string? attrid, string? cultid, string qualid, bool gebunden, double oe, double kmw) {
public decimal CalculatePrice(string sortid, string? attrid, string? cultid, string qualid, bool contracted, double oe, double kmw) {
var curve = GetQualityCurve(qualid, sortid, attrid, cultid) ?? GetCurve(sortid, attrid, cultid);
return GetCurveValueAt((gebunden ? curve.Gebunden : null) ?? curve.Normal, curve.Mode == CurveMode.Oe ? oe : kmw);
return GetCurveValueAt((contracted ? curve.Contracted : null) ?? curve.Normal, curve.Mode == CurveMode.Oe ? oe : kmw);
}
private Curve LookupCurve(JsonValue val) {
+8 -8
View File
@@ -641,10 +641,10 @@ namespace Elwig.Helpers.Export {
["ooc_id"] = m.OrganicOperatorId,
["org_auth_code"] = m.OrganicAuthorityCode,
["juridical_pers"] = m.IsJuridicalPerson,
["volllieferant"] = m.IsVollLieferant,
["buchführend"] = m.IsBuchführend,
["full_delivery"] = m.IsFullDelivery,
["accounting"] = m.IsAccounting,
["organic"] = m.IsOrganic,
["funktionär"] = m.IsFunktionär,
["officer"] = m.IsOfficer,
["active"] = m.IsActive,
["deceased"] = m.IsDeceased,
["iban"] = m.Iban,
@@ -715,10 +715,10 @@ namespace Elwig.Helpers.Export {
OrganicOperatorId = json["ooc_id"]?.AsValue().GetValue<string>(),
OrganicAuthorityCode = json["org_auth_code"]?.AsValue().GetValue<string>(),
IsJuridicalPerson = json["juridical_pers"]?.AsValue().GetValue<bool>() ?? false,
IsVollLieferant = json["volllieferant"]?.AsValue().GetValue<bool>() ?? false,
IsBuchführend = json["buchführend"]?.AsValue().GetValue<bool>() ?? false,
IsFullDelivery = json["full_delivery"]?.AsValue().GetValue<bool>() ?? json["volllieferant"]?.AsValue().GetValue<bool>() ?? false,
IsAccounting = json["accounting"]?.AsValue().GetValue<bool>() ?? json["buchführend"]?.AsValue().GetValue<bool>() ?? false,
IsOrganic = json["organic"]?.AsValue().GetValue<bool>() ?? false,
IsFunktionär = json["funktionär"]?.AsValue().GetValue<bool>() ?? false,
IsOfficer = json["officer"]?.AsValue().GetValue<bool>() ?? json["funktionär"]?.AsValue().GetValue<bool>() ?? false,
IsActive = json["active"]?.AsValue().GetValue<bool>() ?? false,
IsDeceased = json["deceased"]?.AsValue().GetValue<bool>() ?? false,
Iban = json["iban"]?.AsValue().GetValue<string>(),
@@ -961,7 +961,7 @@ namespace Elwig.Helpers.Export {
};
if (p.IsSplCheck) obj["spl_check"] = p.IsSplCheck;
if (p.IsHandPicked != null) obj["hand_picked"] = p.IsHandPicked;
if (p.IsGebunden != null) obj["gebunden"] = p.IsGebunden;
if (p.IsContracted != null) obj["contracted"] = p.IsContracted;
if (p.Unloading != null) obj["unloading"] = p.Unloading;
if (p.Temperature != null) obj["temperature"] = p.Temperature;
if (p.Acid != null) obj["acid"] = p.Acid;
@@ -1035,7 +1035,7 @@ namespace Elwig.Helpers.Export {
Comment = p["comment"]?.AsValue().GetValue<string>(),
IsSplCheck = p["spl_check"]?.AsValue().GetValue<bool>() ?? false,
IsHandPicked = p["hand_picked"]?.AsValue().GetValue<bool>(),
IsGebunden = p["gebunden"]?.AsValue().GetValue<bool>(),
IsContracted = p["contracted"]?.AsValue().GetValue<bool>() ?? p["gebunden"]?.AsValue().GetValue<bool>(),
Unloading = p["unloading"]?.AsValue().GetValue<string>() ?? ((p["lesewagen"]?.AsValue().GetValue<bool>() ?? false) ? DeliveryPart.Pumped : null),
Temperature = p["temperature"]?.AsValue().GetValue<double>(),
Acid = p["acid"]?.AsValue().GetValue<double>(),
+3 -3
View File
@@ -25,7 +25,7 @@ namespace Elwig.Models.Dtos {
("BillingPlz", "PLZ", null, 10),
("BillingLocality", "Ort", null, 60),
("LfbisNr", "Betr.-Nr.", null, 20),
("IsBuchführend", "buchf.", null, 15),
("IsAccounting", "buchf.", null, 15),
("IsOrganic", "Bio", null, 15),
("IsActive", "aktiv", null, 15),
("EntryDate", "Eintritt", null, 20),
@@ -83,7 +83,7 @@ namespace Elwig.Models.Dtos {
public string? Bic;
public int? AreaCommitment;
public (string VtrgId, int Area)[] AreaCommitmentsFiltered;
public bool IsBuchführend;
public bool IsAccounting;
public bool IsOrganic;
public bool IsActive;
public DateOnly? EntryDate;
@@ -118,7 +118,7 @@ namespace Elwig.Models.Dtos {
UstIdNr = m.UstIdNr;
Iban = m.Iban != null ? Utils.FormatIban(m.Iban) : null;
Bic = m.Bic;
IsBuchführend = m.IsBuchführend;
IsAccounting = m.IsAccounting;
IsOrganic = m.IsOrganic;
IsActive = m.IsActive;
EntryDate = m.EntryDate;
+36 -36
View File
@@ -18,9 +18,9 @@ namespace Elwig.Models.Dtos {
("Cultivation", "Bewirt.", null, 20),
("QualityLevel", "Qualitätsstufe", null, 30),
("Oe", "Gradation", "°Oe", 20),
("Ungeb", "ungebunden", "kg|€/kg|€/kg", 60),
("LowGeb", "attributlos gebunden", "kg|€/kg|€/kg", 60),
("Geb", "gebunden", "kg|€/kg|€/kg", 60),
("UnCtrd", "ungebunden", "kg|€/kg|€/kg", 60),
("LowCtrd", "attributlos gebunden", "kg|€/kg|€/kg", 60),
("Ctrd", "gebunden", "kg|€/kg|€/kg", 60),
("Amount", "Gesamt", "€", 25),
];
@@ -31,9 +31,9 @@ namespace Elwig.Models.Dtos {
string? Cultivation,
string QualityLevel,
double Oe,
(int Weight, decimal? MinPrice, decimal? MaxPrice) Ungeb,
(int Weight, decimal? MinPrice, decimal? MaxPrice) LowGeb,
(int Weight, decimal? MinPrice, decimal? MaxPrice) Geb,
(int Weight, decimal? MinPrice, decimal? MaxPrice) UnCtrd,
(int Weight, decimal? MinPrice, decimal? MaxPrice) LowCtrd,
(int Weight, decimal? MinPrice, decimal? MaxPrice) Ctrd,
decimal Amount
);
@@ -44,9 +44,9 @@ namespace Elwig.Models.Dtos {
public static async Task<PaymentVariantSummaryData> ForPaymentVariant(PaymentVar v, DbSet<PaymentVariantSummaryRow> table) {
return new(v, (await FromDbSet(table, v.Year, v.AvNr))
.Select(r => new PaymentRow(r.Type, r.Variety, r.Attribute, r.Cultivation, r.QualityLevel, r.Oe,
(r.WeightUngeb, r.MinPriceUngeb != null ? Utils.DecFromDb(r.MinPriceUngeb.Value, v.Season.Precision) : null, r.MaxPriceUngeb != null ? Utils.DecFromDb(r.MaxPriceUngeb.Value, v.Season.Precision) : null),
(r.WeightLowGeb, r.MinPriceLowGeb != null ? Utils.DecFromDb(r.MinPriceLowGeb.Value, v.Season.Precision) : null, r.MaxPriceLowGeb != null ? Utils.DecFromDb(r.MaxPriceLowGeb.Value, v.Season.Precision) : null),
(r.WeightGeb, r.MinPriceGeb != null ? Utils.DecFromDb(r.MinPriceGeb.Value, v.Season.Precision) : null, r.MaxPriceGeb != null ? Utils.DecFromDb(r.MaxPriceGeb.Value, v.Season.Precision) : null),
(r.WeightUnCtrd, r.MinPriceUnCtrd != null ? Utils.DecFromDb(r.MinPriceUnCtrd.Value, v.Season.Precision) : null, r.MaxPriceUnCtrd != null ? Utils.DecFromDb(r.MaxPriceUnCtrd.Value, v.Season.Precision) : null),
(r.WeightLowCtrd, r.MinPriceLowCtrd != null ? Utils.DecFromDb(r.MinPriceLowCtrd.Value, v.Season.Precision) : null, r.MaxPriceLowCtrd != null ? Utils.DecFromDb(r.MaxPriceLowCtrd.Value, v.Season.Precision) : null),
(r.WeightCtrd, r.MinPriceCtrd != null ? Utils.DecFromDb(r.MinPriceCtrd.Value, v.Season.Precision) : null, r.MaxPriceCtrd != null ? Utils.DecFromDb(r.MaxPriceCtrd.Value, v.Season.Precision) : null),
Utils.DecFromDb(r.Amount, v.Season.Precision)))
.ToArray());
}
@@ -59,15 +59,15 @@ namespace Elwig.Models.Dtos {
c.name AS cultivation,
q.name AS quality_level,
ROUND(kmw * (4.54 + 0.022 * kmw)) AS oe,
SUM(IIF(w.discr = '_', w.value, 0)) AS weight_ungeb,
MIN(IIF(w.discr = '_', b.price, NULL)) AS min_price_ungeb,
MAX(IIF(w.discr = '_', b.price, NULL)) AS max_price_ungeb,
SUM(IIF(w.discr NOT IN (COALESCE(p.attrid, ''), '_'), w.value, 0)) AS weight_lowgeb,
MIN(IIF(w.discr NOT IN (COALESCE(p.attrid, ''), '_'), b.price, NULL)) AS min_price_lowgeb,
MAX(IIF(w.discr NOT IN (COALESCE(p.attrid, ''), '_'), b.price, NULL)) AS max_price_lowgeb,
SUM(IIF(w.discr = COALESCE(p.attrid, ''), w.value, 0)) AS weight_geb,
MIN(IIF(w.discr = COALESCE(p.attrid, ''), b.price, NULL)) AS min_price_geb,
MAX(IIF(w.discr = COALESCE(p.attrid, ''), b.price, NULL)) AS max_price_geb,
SUM(IIF(w.discr = '_', w.value, 0)) AS weight_unctrd,
MIN(IIF(w.discr = '_', b.price, NULL)) AS min_price_unctrd,
MAX(IIF(w.discr = '_', b.price, NULL)) AS max_price_unctrd,
SUM(IIF(w.discr NOT IN (COALESCE(p.attrid, ''), '_'), w.value, 0)) AS weight_lowctrd,
MIN(IIF(w.discr NOT IN (COALESCE(p.attrid, ''), '_'), b.price, NULL)) AS min_price_lowctrd,
MAX(IIF(w.discr NOT IN (COALESCE(p.attrid, ''), '_'), b.price, NULL)) AS max_price_lowctrd,
SUM(IIF(w.discr = COALESCE(p.attrid, ''), w.value, 0)) AS weight_ctrd,
MIN(IIF(w.discr = COALESCE(p.attrid, ''), b.price, NULL)) AS min_price_ctrd,
MAX(IIF(w.discr = COALESCE(p.attrid, ''), b.price, NULL)) AS max_price_ctrd,
SUM(b.amount) AS amount
FROM payment_delivery_part_bucket b
LEFT JOIN delivery_part_bucket w ON (w.year, w.did, w.dpnr, w.bktnr) = (b.year, b.did, b.dpnr, b.bktnr)
@@ -97,24 +97,24 @@ namespace Elwig.Models.Dtos {
public required string QualityLevel { get; set; }
[Column("oe")]
public double Oe { get; set; }
[Column("weight_ungeb")]
public int WeightUngeb { get; set; }
[Column("min_price_ungeb")]
public long? MinPriceUngeb { get; set; }
[Column("max_price_ungeb")]
public long? MaxPriceUngeb { get; set; }
[Column("weight_lowgeb")]
public int WeightLowGeb { get; set; }
[Column("min_price_lowgeb")]
public long? MinPriceLowGeb { get; set; }
[Column("max_price_lowgeb")]
public long? MaxPriceLowGeb { get; set; }
[Column("weight_geb")]
public int WeightGeb { get; set; }
[Column("min_price_geb")]
public long? MinPriceGeb { get; set; }
[Column("max_price_geb")]
public long? MaxPriceGeb { get; set; }
[Column("weight_unctrd")]
public int WeightUnCtrd { get; set; }
[Column("min_price_unctrd")]
public long? MinPriceUnCtrd { get; set; }
[Column("max_price_unctrd")]
public long? MaxPriceUnCtrd { get; set; }
[Column("weight_lowctrd")]
public int WeightLowCtrd { get; set; }
[Column("min_price_lowctrd")]
public long? MinPriceLowCtrd { get; set; }
[Column("max_price_lowctrd")]
public long? MaxPriceLowCtrd { get; set; }
[Column("weight_ctrd")]
public int WeightCtrd { get; set; }
[Column("min_price_ctrd")]
public long? MinPriceCtrd { get; set; }
[Column("max_price_ctrd")]
public long? MaxPriceCtrd { get; set; }
[Column("amount")]
public long Amount { get; set; }
}
+6 -6
View File
@@ -13,7 +13,7 @@ namespace Elwig.Models.Dtos {
("AttrId", "Attr.", null, 10),
("CultId", "Bewirt.", null, 15),
("QualId", "Qual.", null, 15),
("Geb", "gebunden", null, 20),
("Contracted", "gebunden", null, 20),
("Weight", "Menge", "kg", 20),
];
@@ -28,12 +28,12 @@ namespace Elwig.Models.Dtos {
private static async Task<IEnumerable<WeightBreakdownRow>> FromDbSet(DbSet<WeightBreakdownRow> table, int year, string? zwstid) {
zwstid = zwstid == null ? "NULL" : $"'{zwstid}'";
return await table.FromSqlRaw($"""
SELECT type, sortid, attrid, cultid, v.qualid, geb, SUM(weight) AS weight
SELECT type, sortid, attrid, cultid, v.qualid, contracted, SUM(weight) AS weight
FROM v_stat_total v
LEFT JOIN wine_quality_level q ON q.qualid = v.qualid
WHERE year = {year} AND ({zwstid} IS NULL OR zwstid = {zwstid})
GROUP BY type, sortid, attrid, cultid, v.qualid, geb
ORDER BY type DESC, sortid, attrid, cultid, q.min_kmw, geb
GROUP BY type, sortid, attrid, cultid, v.qualid, contracted
ORDER BY type DESC, sortid, attrid, cultid, q.min_kmw, contracted
""").ToListAsync();
}
}
@@ -50,8 +50,8 @@ namespace Elwig.Models.Dtos {
public string? CultId { get; set; }
[Column("qualid")]
public required string QualId { get; set; }
[Column("geb")]
public required string Geb { get; set; }
[Column("contracted")]
public required string Contracted { get; set; }
[Column("weight")]
public int Weight { get; set; }
}
+2 -2
View File
@@ -91,8 +91,8 @@ namespace Elwig.Models.Entities {
[Column("hand_picked")]
public bool? IsHandPicked { get; set; }
[Column("gebunden")]
public bool? IsGebunden { get; set; }
[Column("contracted")]
public bool? IsContracted { get; set; }
[Column("unloading")]
public string? Unloading { get; set; }
+6 -6
View File
@@ -105,17 +105,17 @@ namespace Elwig.Models.Entities {
[Column("juridical_pers")]
public bool IsJuridicalPerson { get; set; }
[Column("volllieferant")]
public bool IsVollLieferant { get; set; }
[Column("full_delivery")]
public bool IsFullDelivery { get; set; }
[Column("buchführend")]
public bool IsBuchführend { get; set; }
[Column("accounting")]
public bool IsAccounting { get; set; }
[Column("organic")]
public bool IsOrganic { get; set; }
[Column("funktionär")]
public bool IsFunktionär { get; set; }
[Column("officer")]
public bool IsOfficer { get; set; }
[Column("active")]
public bool IsActive { get; set; }
+1 -1
View File
@@ -107,7 +107,7 @@ namespace Elwig.Models.Entities {
[Column("calc_mode")]
public int CalcMode { get; set; }
[NotMapped]
public bool Billing_HonorGebunden {
public bool Billing_HonorContracted {
get => (CalcMode & 0x1) != 0;
set => CalcMode = value ? CalcMode | 0x1 : CalcMode & ~0x1;
}
@@ -92,6 +92,12 @@
{"$ref": "#/definitions/curve_data"}
]
},
"ctrd": {
"anyOf": [
{"type": "number"},
{"$ref": "#/definitions/curve_data"}
]
},
"geb": {
"anyOf": [
{"type": "number"},
+24
View File
@@ -9,6 +9,30 @@ ALTER TABLE member_history RENAME COLUMN signed TO signed_member;
ALTER TABLE member_history ADD COLUMN signed_company INTEGER NOT NULL CHECK (signed_company IN (TRUE, FALSE)) DEFAULT FALSE;
PRAGMA writable_schema = ON;
UPDATE sqlite_schema SET sql = REPLACE(REPLACE(REPLACE(sql, 'funktionär', 'officer '), 'buchführend', 'accounting '), 'volllieferant', 'full_delivery')
WHERE type = 'table' AND name = 'member';
UPDATE sqlite_schema SET sql = REPLACE(sql, 'gebunden', 'contracted')
WHERE type = 'table' AND name = 'delivery_part';
UPDATE sqlite_schema SET sql = REPLACE(sql, 'gebunden', 'contracted')
WHERE type = 'view' AND name = 'v_delivery';
UPDATE sqlite_schema SET sql = REPLACE(sql, 'volllieferant', 'full_delivery')
WHERE type = 'view' AND name = 'v_bki_member';
UPDATE sqlite_schema SET sql = REPLACE(sql, ' geb', ' contracted')
WHERE type = 'view' AND name = 'v_stat_total';
UPDATE sqlite_schema SET sql = REPLACE(sql, 'gebunden', 'contracted')
WHERE type = 'view' AND (name = 'v_payment_bucket_strict' OR name = 'v_payment_bucket' OR name = 'v_under_delivery_bucket');
PRAGMA schema_version = 4101;
PRAGMA writable_schema = OFF;
UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS';
UPDATE member SET org_auth_code = UPPER(SUBSTR(a.name, -11, 10))
+6 -6
View File
@@ -75,7 +75,7 @@ namespace Elwig.Services {
vm.TemperatureString = (p.Temperature != null) ? $"{p.Temperature:N1}" : "";
vm.AcidString = (p.Acid != null) ? $"{p.Acid:N1}" : "";
vm.IsHandPicked = p.IsHandPicked;
vm.IsGebunden = p.IsGebunden;
vm.IsContracted = p.IsContracted;
vm.Unloading = p.Unloading;
vm.ScaleTerminalId = p.ScaleTerminalId;
@@ -181,19 +181,19 @@ namespace Elwig.Services {
filter.RemoveAt(i--);
filterNames.Add("Weißweinsorten");
} else if (e.Length >= 3 && e.Length <= 8 && "gebunden".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
prd = prd.And(p => p.IsGebunden == true);
prd = prd.And(p => p.IsContracted == true);
filter.RemoveAt(i--);
filterNames.Add("gebunden");
} else if (e.Length >= 4 && e.Length <= 9 && "!gebunden".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
prd = prd.And(p => p.IsGebunden != true);
prd = prd.And(p => p.IsContracted != true);
filter.RemoveAt(i--);
filterNames.Add("nicht gebunden");
} else if (e.Length >= 5 && e.Length <= 10 && "ungebunden".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
prd = prd.And(p => p.IsGebunden == false);
prd = prd.And(p => p.IsContracted == false);
filter.RemoveAt(i--);
filterNames.Add("ungebunden");
} else if (e.Length >= 6 && e.Length <= 11 && "!ungebunden".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
prd = prd.And(p => p.IsGebunden != false);
prd = prd.And(p => p.IsContracted != false);
filter.RemoveAt(i--);
filterNames.Add("nicht ungebunden");
} else if (e.Length >= 5 && e.Length <= 8 && "handlese".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
@@ -556,7 +556,7 @@ namespace Elwig.Services {
IsNetWeight = vm.IsNetWeight,
IsHandPicked = vm.IsHandPicked,
IsGebunden = vm.IsGebunden,
IsContracted = vm.IsContracted,
Unloading = vm.Unloading,
Temperature = vm.Temperature,
Acid = vm.Acid,
+24 -16
View File
@@ -116,7 +116,7 @@ namespace Elwig.Services {
vm.LfbisNr = m.LfbisNr;
vm.OrganicOperatorId = m.OrganicOperatorId;
vm.OrganicAuthorityCode = m.OrganicAuthorityCode;
vm.IsBuchführend = m.IsBuchführend;
vm.IsAccounting = m.IsAccounting;
vm.IsOrganic = m.IsOrganic;
var billingAddr = m.BillingAddress;
@@ -150,8 +150,8 @@ namespace Elwig.Services {
vm.DefaultKg = (AT_Kg?)ControlUtils.GetItemFromSourceWithPk(vm.DefaultKgSource, m.DefaultKgNr);
vm.Comment = m.Comment;
vm.IsActive = m.IsActive;
vm.IsVollLieferant = m.IsVollLieferant;
vm.IsFunktionär = m.IsFunktionär;
vm.IsFullDelivery = m.IsFullDelivery;
vm.IsOfficer = m.IsOfficer;
vm.ContactViaPost = m.ContactViaPost;
vm.ContactViaEmail = m.ContactViaEmail;
@@ -319,11 +319,11 @@ namespace Elwig.Services {
filter.RemoveAt(i--);
filterNames.Add("inaktive Mitglieder");
} else if (e.Length >= 5 && e.Length <= 10 && "funktionär".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => m.IsFunktionär);
memberQuery = memberQuery.Where(m => m.IsOfficer);
filter.RemoveAt(i--);
filterNames.Add("Funktionäre");
} else if (e.Length >= 6 && e.Length <= 11 && e[0] == '!' && "funktionär".StartsWith(e[1..], StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => !m.IsFunktionär);
memberQuery = memberQuery.Where(m => !m.IsOfficer);
filter.RemoveAt(i--);
filterNames.Add("Nicht-Funktionäre");
} else if (e.Equals("bio", StringComparison.CurrentCultureIgnoreCase)) {
@@ -334,28 +334,36 @@ namespace Elwig.Services {
memberQuery = memberQuery.Where(m => !m.IsOrganic);
filter.RemoveAt(i--);
filterNames.Add("Nicht-Bio-Betriebe");
} else if (e.Length >= 4 && e.Length <= 14 && "vollablieferer".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => m.IsFullDelivery);
filter.RemoveAt(i--);
filterNames.Add("Vollablieferer");
} else if (e.Length >= 4 && e.Length <= 13 && "volllieferant".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => m.IsVollLieferant);
memberQuery = memberQuery.Where(m => m.IsFullDelivery);
filter.RemoveAt(i--);
filterNames.Add("Volllieferanten");
filterNames.Add("Vollablieferer");
} else if (e.Length >= 5 && e.Length <= 15 && e[0] == '!' && "vollablieferer".StartsWith(e[1..], StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => !m.IsFullDelivery);
filter.RemoveAt(i--);
filterNames.Add("Nicht-Vollablieferer");
} else if (e.Length >= 5 && e.Length <= 14 && e[0] == '!' && "volllieferant".StartsWith(e[1..], StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => !m.IsVollLieferant);
memberQuery = memberQuery.Where(m => !m.IsFullDelivery);
filter.RemoveAt(i--);
filterNames.Add("Nicht-Vollieferanten");
filterNames.Add("Nicht-Vollablieferer");
} else if (e.Length >= 5 && e.Length <= 11 && "buchführend".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => m.IsBuchführend);
memberQuery = memberQuery.Where(m => m.IsAccounting);
filter.RemoveAt(i--);
filterNames.Add("buchführend");
} else if (e.Length >= 6 && e.Length <= 12 && e[0] == '!' && "buchführend".StartsWith(e[1..], StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => !m.IsBuchführend);
memberQuery = memberQuery.Where(m => !m.IsAccounting);
filter.RemoveAt(i--);
filterNames.Add("pauschaliert");
} else if (e.Length >= 8 && e.Length <= 12 && "pauschaliert".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => !m.IsBuchführend);
memberQuery = memberQuery.Where(m => !m.IsAccounting);
filter.RemoveAt(i--);
filterNames.Add("pauschaliert");
} else if (e.Length >= 9 && e.Length <= 13 && e[0] == '!' && "pauschaliert".StartsWith(e[1..], StringComparison.CurrentCultureIgnoreCase)) {
memberQuery = memberQuery.Where(m => m.IsBuchführend);
memberQuery = memberQuery.Where(m => m.IsAccounting);
filter.RemoveAt(i--);
filterNames.Add("buchführend");
} else if (e.Equals("email", StringComparison.CurrentCultureIgnoreCase)) {
@@ -629,7 +637,7 @@ namespace Elwig.Services {
LfbisNr = string.IsNullOrWhiteSpace(vm.LfbisNr) ? null : vm.LfbisNr,
OrganicOperatorId = string.IsNullOrWhiteSpace(vm.OrganicOperatorId) ? null : vm.OrganicOperatorId,
OrganicAuthorityCode = string.IsNullOrWhiteSpace(vm.OrganicAuthorityCode) ? null : vm.OrganicAuthorityCode,
IsBuchführend = vm.IsBuchführend,
IsAccounting = vm.IsAccounting,
IsOrganic = vm.IsOrganic,
EntryDateString = string.IsNullOrWhiteSpace(vm.EntryDate) ? null : string.Join("-", vm.EntryDate.Split(".").Reverse()),
@@ -640,8 +648,8 @@ namespace Elwig.Services {
SharesDormant = App.Client.HasRedWhite ? vm.BusinessShares3 ?? 0 : vm.BusinessShares2 ?? 0,
AccountingNr = string.IsNullOrWhiteSpace(vm.AccountingNr) ? null : vm.AccountingNr,
IsActive = vm.IsActive,
IsVollLieferant = vm.IsVollLieferant,
IsFunktionär = vm.IsFunktionär,
IsFullDelivery = vm.IsFullDelivery,
IsOfficer = vm.IsOfficer,
ZwstId = vm.Branch?.ZwstId,
DefaultKgNr = vm.DefaultKg?.KgNr,
Comment = string.IsNullOrWhiteSpace(vm.Comment) ? null : vm.Comment,
+2 -2
View File
@@ -159,10 +159,10 @@ namespace Elwig.Services {
foreach (int mgnr in currentPayments.Keys) {
var c = currentPayments[mgnr];
var l = lastPayments.GetValueOrDefault(mgnr);
vatSum += (c.Amount - (l?.Amount ?? 0)) * (decimal)(c.Member.IsBuchführend ? v.Season.VatNormal : v.Season.VatFlatrate);
vatSum += (c.Amount - (l?.Amount ?? 0)) * (decimal)(c.Member.IsAccounting ? v.Season.VatNormal : v.Season.VatFlatrate);
}
} else {
vatSum = currentPayments.Sum(e => e.Value.Amount * (decimal)(e.Value.Member.IsBuchführend ? v.Season.VatNormal : v.Season.VatFlatrate));
vatSum = currentPayments.Sum(e => e.Value.Amount * (decimal)(e.Value.Member.IsAccounting ? v.Season.VatNormal : v.Season.VatFlatrate));
}
vatText = $"~{vatSum:N2} {sym}";
deductionText = $"- {sym}";
+1 -1
View File
@@ -157,7 +157,7 @@ namespace Elwig.ViewModels {
[ObservableProperty]
public partial IEnumerable<object> WineRdSource { get; set; } = [];
[ObservableProperty]
public partial bool? IsGebunden { get; set; }
public partial bool? IsContracted { get; set; }
public ObservableCollection<Modifier> Modifiers { get; set; } = [];
[ObservableProperty]
+3 -3
View File
@@ -125,7 +125,7 @@ namespace Elwig.ViewModels {
[ObservableProperty]
public partial string? OrganicAuthorityCode { get; set; }
[ObservableProperty]
public partial bool IsBuchführend { get; set; }
public partial bool IsAccounting { get; set; }
[ObservableProperty]
public partial bool IsOrganic { get; set; }
@@ -165,9 +165,9 @@ namespace Elwig.ViewModels {
[ObservableProperty]
public partial bool IsActive { get; set; }
[ObservableProperty]
public partial bool IsVollLieferant { get; set; }
public partial bool IsFullDelivery { get; set; }
[ObservableProperty]
public partial bool IsFunktionär { get; set; }
public partial bool IsOfficer { get; set; }
[ObservableProperty]
public partial Branch? Branch { get; set; }
[ObservableProperty]
+1 -1
View File
@@ -574,7 +574,7 @@
<CheckBox x:Name="ParameterAvoidUnderDeliveriesInput" Content="Unterlieferungen durch Abzug bei &quot;besseren&quot; Flächenbindungen vermeiden"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,30,10,10"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
<CheckBox x:Name="ParameterHonorGebundenInput" Margin="10,50,10,10" VerticalAlignment="Top"
<CheckBox x:Name="ParameterHonorContractedInput" Margin="10,50,10,10" VerticalAlignment="Top"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed">
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
</CheckBox>
+2 -2
View File
@@ -352,7 +352,7 @@ namespace Elwig.Windows {
ParameterBusinessShareHistoryInput.IsChecked = p.EnableMemberHistory;
ParameterAllowAttrIntoLowerInput.IsChecked = s?.Billing_AllowAttrsIntoLower ?? false;
ParameterAvoidUnderDeliveriesInput.IsChecked = s?.Billing_AvoidUnderDeliveries ?? false;
ParameterHonorGebundenInput.IsChecked = s?.Billing_HonorGebunden ?? false;
ParameterHonorContractedInput.IsChecked = s?.Billing_HonorContracted ?? false;
ParameterExportEbicsVersion.SelectedIndex = p.ExportEbicsVersion - 3;
ParameterExportEbicsAddress.SelectedIndex = p.ExportEbicsAddress;
@@ -406,7 +406,7 @@ namespace Elwig.Windows {
s.Billing_AllowAttrsIntoLower = ParameterAllowAttrIntoLowerInput.IsChecked ?? false;
s.Billing_AvoidUnderDeliveries = ParameterAvoidUnderDeliveriesInput.IsChecked ?? false;
s.Billing_HonorGebunden = ParameterHonorGebundenInput.IsChecked ?? false;
s.Billing_HonorContracted = ParameterHonorContractedInput.IsChecked ?? false;
ctx.Update(s);
await ctx.SaveChangesAsync();
} catch { }
+7 -7
View File
@@ -138,9 +138,9 @@
<Label Content="Oechsle:" Margin="10,10,0,0" Grid.Column="0"/>
<ctrl:UnitTextBox x:Name="OechsleInput" Unit="°Oe" TextChanged="OechsleInput_TextChanged" IsEnabled="False"
Grid.Column="1" Width="52" Margin="0,10,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<CheckBox x:Name="GebInput" Content="Geb." IsEnabled="False"
<CheckBox x:Name="ContractedInput" Content="Geb." IsEnabled="False"
Grid.Column="1" Margin="0,15,10,0" HorizontalAlignment="Right" VerticalAlignment="Top"
Checked="GebInput_Changed" Unchecked="GebInput_Changed"/>
Checked="ContractedInput_Changed" Unchecked="ContractedInput_Changed"/>
<Label Content="Preis:" Margin="10,40,0,0" Grid.Column="0"/>
<ctrl:UnitTextBox x:Name="PriceInput" Unit="€/kg" TextChanged="PriceInput_TextChanged" IsEnabled="False"
@@ -148,16 +148,16 @@
</Grid>
</GroupBox>
<GroupBox Header="Gebunden Aufschlag" Grid.Row="1" Margin="0,5,5,5">
<GroupBox Header="Gebunden-Aufschlag" Grid.Row="1" Margin="0,5,5,5">
<Grid>
<StackPanel Margin="10,10,0,0">
<RadioButton x:Name="GebundenTypeFixed" GroupName="GebundenType" Checked="GebundenType_Checked" IsEnabled="False">Fix</RadioButton>
<RadioButton x:Name="GebundenTypeGraph" GroupName="GebundenType" Checked="GebundenType_Checked" IsEnabled="False">Frei</RadioButton>
<RadioButton x:Name="GebundenTypeNone" GroupName="GebundenType" Checked="GebundenType_Checked" IsEnabled="False">Nein</RadioButton>
<RadioButton x:Name="ContractedTypeFixed" GroupName="ContractedType" Checked="ContractedType_Checked" IsEnabled="False">Fix</RadioButton>
<RadioButton x:Name="ContractedTypeGraph" GroupName="ContractedType" Checked="ContractedType_Checked" IsEnabled="False">Frei</RadioButton>
<RadioButton x:Name="ContractedTypeNone" GroupName="ContractedType" Checked="ContractedType_Checked" IsEnabled="False">Nein</RadioButton>
</StackPanel>
<ctrl:UnitTextBox x:Name="GebundenFlatBonus" Unit="€/kg" TextChanged="GebundenFlatBonus_TextChanged" IsEnabled="False"
<ctrl:UnitTextBox x:Name="ContractedFlatBonus" Unit="€/kg" TextChanged="ContractedFlatBonus_TextChanged" IsEnabled="False"
Width="90" Margin="5,5,5,5" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.Column="1"/>
</Grid>
</GroupBox>
+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;
}
+1 -1
View File
@@ -682,7 +682,7 @@
Margin="0,70,10,10" Grid.Column="1"
DisplayMemberPath="Name"/>
<CheckBox x:Name="GebundenInput" IsChecked="{Binding IsGebunden, Mode=TwoWay}"
<CheckBox x:Name="ContractedInput" IsChecked="{Binding IsContracted, Mode=TwoWay}"
Content="Gebunden" Margin="10,105,0,0" Grid.Column="0" Grid.ColumnSpan="2" IsThreeState="True"
VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed" Indeterminate="CheckBox_Changed"/>
+5 -5
View File
@@ -356,11 +356,11 @@ namespace Elwig.Windows {
}
if (App.Client.IsMatzen || App.Client.IsWinzerkeller || App.Client.IsBaden || App.Client.IsWeinland) {
GebundenInput.IsEnabled = false;
SetDefaultValue(GebundenInput, null);
ContractedInput.IsEnabled = false;
SetDefaultValue(ContractedInput, null);
} else {
GebundenInput.IsEnabled = true;
UnsetDefaultValue(GebundenInput);
ContractedInput.IsEnabled = true;
UnsetDefaultValue(ContractedInput);
}
}
@@ -376,7 +376,7 @@ namespace Elwig.Windows {
ViewModel.IsNetWeight = App.Config.WeighingMode == WeighingMode.Net;
ViewModel.IsHandPicked = App.Config.WeighingMode != WeighingMode.Net ? true : null;
ViewModel.Unloading = null;
ViewModel.IsGebunden = null;
ViewModel.IsContracted = null;
InitialDefaultInputs();
//WineQualityLevelInput.IsEnabled = false; // disable wine quality level input in Übernahme
+4 -4
View File
@@ -167,14 +167,14 @@
Margin="180,225,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<Label Content="Funktionär:" x:Name="MemberFunktionärLabel" Margin="10,250,0,10"/>
<RadioButton x:Name="MemberFunktionärYesInput" Content="Ja" GroupName="MemberFunktionär"
<Label Content="Funktionär:" x:Name="MemberOfficerLabel" Margin="10,250,0,10"/>
<RadioButton x:Name="MemberOfficerYesInput" Content="Ja" GroupName="MemberOfficer"
Margin="80,255,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<RadioButton x:Name="MemberFunktionärNoInput" Content="Nein" GroupName="MemberFunktionär"
<RadioButton x:Name="MemberOfficerNoInput" Content="Nein" GroupName="MemberOfficer"
Margin="125,255,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
<RadioButton x:Name="MemberFunktionärIndifferentInput" Content="Egal" GroupName="MemberFunktionär"
<RadioButton x:Name="MemberOfficerIndifferentInput" Content="Egal" GroupName="MemberOfficer"
Margin="180,255,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
Checked="MemberInput_Checked"/>
+9 -9
View File
@@ -122,7 +122,7 @@ namespace Elwig.Windows {
RecipientsActiveMembersInput.IsChecked = true;
MemberOrganicIndifferentInput.IsChecked = true;
MemberFunktionärIndifferentInput.IsChecked = true;
MemberOfficerIndifferentInput.IsChecked = true;
DeliveryConfirmationFooterInput.Text = App.Client.TextDeliveryConfirmation;
CreditNoteFooterInput.Text = App.Client.TextCreditNote;
@@ -408,10 +408,10 @@ namespace Elwig.Windows {
MemberOrganicYesInput.Visibility = vis;
MemberOrganicNoInput.Visibility = vis;
MemberOrganicIndifferentInput.Visibility = vis;
MemberFunktionärLabel.Visibility = vis;
MemberFunktionärYesInput.Visibility = vis;
MemberFunktionärNoInput.Visibility = vis;
MemberFunktionärIndifferentInput.Visibility = vis;
MemberOfficerLabel.Visibility = vis;
MemberOfficerYesInput.Visibility = vis;
MemberOfficerNoInput.Visibility = vis;
MemberOfficerIndifferentInput.Visibility = vis;
MemberAreaComInput.Visibility = RecipientsAreaComMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
MemberAreaComLabel.Visibility = RecipientsAreaComMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
MemberDeliveryAncmtInput.Visibility = RecipientsDeliveryAncmtMembersInput.IsChecked == true ? Visibility.Visible : Visibility.Hidden;
@@ -459,10 +459,10 @@ namespace Elwig.Windows {
} else if (MemberOrganicNoInput.IsChecked == true) {
query = query.Where(m => !m.IsOrganic);
}
if (MemberFunktionärYesInput.IsChecked == true) {
query = query.Where(m => m.IsFunktionär);
} else if (MemberFunktionärNoInput.IsChecked == true) {
query = query.Where(m => !m.IsFunktionär);
if (MemberOfficerYesInput.IsChecked == true) {
query = query.Where(m => m.IsOfficer);
} else if (MemberOfficerNoInput.IsChecked == true) {
query = query.Where(m => !m.IsOfficer);
}
if (RecipientsAreaComMembersInput.IsChecked == true) {
+3 -3
View File
@@ -301,12 +301,12 @@
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">Ungebunden:</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersTotal">-</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersGeb">-</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="1" TextAlignment="Right" x:Name="SeasonStatMembersCtrd">-</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="1" TextAlignment="Right">-</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightTotal">-</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightGeb">-</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightUngeb">-</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightCtrd">-</TextBlock>
<TextBlock Grid.Row="3" Grid.Column="2" TextAlignment="Right" x:Name="SeasonStatWeightUnCtrd">-</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="3" TextAlignment="Right">-</TextBlock>
<TextBlock Grid.Row="2" Grid.Column="3" TextAlignment="Right" x:Name="SeasonStatArea">-</TextBlock>
+8 -8
View File
@@ -406,26 +406,26 @@ namespace Elwig.Windows {
BreakdownMemberVarietyButton.IsEnabled = valid;
SeasonStatMembersTotal.Text = "-";
SeasonStatMembersGeb.Text = "-";
SeasonStatMembersCtrd.Text = "-";
SeasonStatWeightTotal.Text = "-";
SeasonStatWeightGeb.Text = "-";
SeasonStatWeightUngeb.Text = "-";
SeasonStatWeightCtrd.Text = "-";
SeasonStatWeightUnCtrd.Text = "-";
SeasonStatArea.Text = "-";
if (valid) {
await Task.Run(async () => {
var membersTotal = await ctx.Deliveries.Where(d => d.Year == year).Select(d => d.Member).Distinct().CountAsync();
var areaComs = Utils.ActiveAreaCommitments(ctx.AreaCommitments, year!.Value);
var membersGeb = await areaComs.Select(c => c.Member).Distinct().CountAsync();
var membersCtrd = await areaComs.Select(c => c.Member).Distinct().CountAsync();
var weightTotal = await ctx.DeliveryParts.Where(p => p.Year == year).SumAsync(p => p.Weight);
var gebWeight = await ctx.DeliveryPartBuckets.Where(b => b.Year == year && b.Discr != "_").SumAsync(b => b.Value);
var ctrdWeight = await ctx.DeliveryPartBuckets.Where(b => b.Year == year && b.Discr != "_").SumAsync(b => b.Value);
var area = await areaComs.SumAsync(c => c.Area);
await App.MainDispatcher.BeginInvoke(() => {
if (year != SeasonInput.Value) return;
SeasonStatMembersTotal.Text = $"{membersTotal:N0}";
SeasonStatMembersGeb.Text = $"{membersGeb:N0}";
SeasonStatMembersCtrd.Text = $"{membersCtrd:N0}";
SeasonStatWeightTotal.Text = $"{weightTotal:N0} kg";
SeasonStatWeightGeb.Text = $"{gebWeight:N0} kg";
SeasonStatWeightUngeb.Text = $"{weightTotal - gebWeight:N0} kg";
SeasonStatWeightCtrd.Text = $"{ctrdWeight:N0} kg";
SeasonStatWeightUnCtrd.Text = $"{weightTotal - ctrdWeight:N0} kg";
SeasonStatArea.Text = $"{area:N0} m²";
});
});
+4 -4
View File
@@ -204,7 +204,7 @@
<Bold>Aktiv</Bold>: aktiv, !Aktiv (nicht-aktiv)<LineBreak/>
<Bold>Bio-Betrieb</Bold>: BIO, !bio (ausgenommen Bio)<LineBreak/>
<Bold>Buchführend</Bold>: buchf[ührend], Pauschal[iert], !buchf[ührend]<LineBreak/>
<Bold>Volllieferant</Bold>: voll[lieferant], !Voll[lieferant] (nicht-Volllieferant)<LineBreak/>
<Bold>Vollablieferer</Bold>: voll[ablieferer], voll[lieferant], !Voll[lieferant] (nicht-Vollablieferer)<LineBreak/>
<Bold>Funktionär</Bold>: Funkt[ionär], !funkt[ionär] (nicht-Funktionär)<LineBreak/>
<Bold>Telefon-Nr.</Bold>: z.B. +436641234, ....<LineBreak/>
<Bold>Kontaktdaten</Bold>: email (mind. 1 E-Mail-Adr.), telnr (mind. 1 Tel.-Nr.), !email (keine E-Mail-Adr.), !telnr (keine Tel.-Nr.)<LineBreak/>
@@ -569,7 +569,7 @@
Checked="OrganicInput_Changed" Unchecked="OrganicInput_Changed"
Grid.Column="2" HorizontalAlignment="Left" Margin="5,15,0,0" VerticalAlignment="Top"/>
<CheckBox x:Name="BuchführendInput" Content="Buchführend" IsChecked="{Binding IsBuchführend, Mode=TwoWay}" IsEnabled="False"
<CheckBox x:Name="AccountingInput" Content="Buchführend" IsChecked="{Binding IsAccounting, Mode=TwoWay}" IsEnabled="False"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
Grid.Column="2" HorizontalAlignment="Left" Margin="5,45,0,0" VerticalAlignment="Top"/>
@@ -660,11 +660,11 @@
Checked="ActiveInput_Changed" Unchecked="ActiveInput_Changed"
Grid.Column="2" HorizontalAlignment="Left" Margin="0,15,0,0" VerticalAlignment="Top"/>
<CheckBox x:Name="VollLieferantInput" Content="Volllieferant" IsChecked="{Binding IsVollLieferant, Mode=TwoWay}" IsEnabled="False"
<CheckBox x:Name="FullDeliveryInput" Content="Vollablieferer" IsChecked="{Binding IsFullDelivery, Mode=TwoWay}" IsEnabled="False"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
Grid.Column="2" HorizontalAlignment="Left" Margin="0,45,0,0" VerticalAlignment="Top"/>
<CheckBox x:Name="FunkionärInput" Content="Funktionär" IsChecked="{Binding IsFunktionär, Mode=TwoWay}" IsEnabled="False"
<CheckBox x:Name="OfficerInput" Content="Funktionär" IsChecked="{Binding IsOfficer, Mode=TwoWay}" IsEnabled="False"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"
Grid.Column="2" HorizontalAlignment="Left" Margin="0,75,0,0" VerticalAlignment="Top"/>
+3 -3
View File
@@ -60,7 +60,7 @@ namespace Tests.E2ETests {
Window.FindElement(By.WpfId("UstIdNrInput")).SendKeys("ATU01234565");
Window.FindElement(By.WpfId("LfbisNrInput")).SendKeys("0123455");
Window.FindElement(By.WpfId("BuchführendInput")).Click();
Window.FindElement(By.WpfId("AccountingInput")).Click();
Window.FindElement(By.WpfId("OrganicInput")).Click();
Window.FindElement(By.WpfId("BillingNameInput")).SendKeys("Neuling KG");
@@ -72,8 +72,8 @@ namespace Tests.E2ETests {
Window.FindElement(By.WpfId("BranchInput")).SelectItem("Matzen");
Window.FindElement(By.WpfId("DefaultKgInput")).SelectItem(3);
Window.FindElement(By.WpfId("VollLieferantInput")).Click();
Window.FindElement(By.WpfId("FunkionärInput")).Click();
Window.FindElement(By.WpfId("FullDeliveryInput")).Click();
Window.FindElement(By.WpfId("OfficerInput")).Click();
Window.FindElement(By.WpfId("CommentInput")).SendKeys("Die lieben Mustermänner und Musterfrauen!");
Window.FindElement(By.WpfId("ContactEmailInput")).Click();
+1 -1
View File
@@ -60,7 +60,7 @@ INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
(101, 2021, 1, '2021-10-01', NULL, 'X', 1),
(101, 2021, 2, '2021-10-01', NULL, 'X', 2),
(101, 2021, 3, '2021-10-01', NULL, 'X', 3);
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, gebunden, net_weight, manual_weighing, spl_check, scale_terminal, weighing_data, weighing_reason) VALUES
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, contracted, net_weight, manual_weighing, spl_check, scale_terminal, weighing_data, weighing_reason) VALUES
(2021, 1, 1, 'GV', 'K', NULL, 4000, 17, 'KAB', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2021, 1, 2, 'GV', NULL, NULL, 4000, 16, 'QUW', 'WLNO', 06109, FALSE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
(2021, 2, 1, 'GV', NULL, 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
+1 -1
View File
@@ -66,7 +66,7 @@ INSERT INTO wb_kg (kgnr, glnr) VALUES
(15216, 2),
(15224, 2);
INSERT INTO member (mgnr, given_name, name, zwstid, volllieferant, buchführend, country, postal_dest, address, default_kgnr, iban, lfbis_nr, ustid_nr, org_auth_code) VALUES
INSERT INTO member (mgnr, given_name, name, zwstid, full_delivery, accounting, country, postal_dest, address, default_kgnr, iban, lfbis_nr, ustid_nr, org_auth_code) VALUES
(101, 'Max', 'Mustermann', 'X', FALSE, FALSE, 40, 222303524, 'Winzerstraße 1', 06109, 'AT811234567890123457', '0123463', NULL , NULL ),
(102, 'Wernhardt', 'Weinbauer', 'X', FALSE, FALSE, 40, 222303524, 'Winzerstraße 2', 06109, 'AT541234567890123458', '0123471', 'ATU12345684', NULL ),
(103, 'Matthäus', 'Musterbauer', 'X', FALSE, FALSE, 40, 212005138, 'Brünner Straße 10', 15224, 'AT271234567890123459', '0123480', NULL , 'AT-BIO-302'),
+1 -1
View File
@@ -6,7 +6,7 @@ INSERT INTO wine_cultivation (cultid, name, description, organic) VALUES
INSERT INTO wine_attribute (attrid, name, active, max_kg_per_ha, strict, fill_lower) VALUES
('K', 'Kabinett', TRUE, NULL, FALSE, 0);
INSERT INTO member (mgnr, given_name, name, zwstid, volllieferant, buchführend, country, postal_dest, address, default_kgnr, iban, lfbis_nr, ustid_nr) VALUES
INSERT INTO member (mgnr, given_name, name, zwstid, full_delivery, accounting, country, postal_dest, address, default_kgnr, iban, lfbis_nr, ustid_nr) VALUES
(201, 'Theodor', 'Testbauer', 'X', FALSE, FALSE, 40, 222303524, 'Teststraße 1', 06109, 'AT811234567890123457', '0123463', NULL ),
(202, 'Thomas', 'Testmann', 'X', FALSE, FALSE, 40, 222303524, 'Teststraße 2', 06109, 'AT541234567890123458', '0123471', 'ATU12345684'),
(203, 'Tina', 'Testwinzer', 'X', FALSE, FALSE, 40, 212005138, 'Teststraße 3', 15224, 'AT271234567890123459', '0123480', NULL ),
+20 -20
View File
@@ -27,17 +27,17 @@ namespace Tests.UnitTests.HelperTests {
};
}
private static void TestCalcOe(PaymentBillingData data, string bucket, double oe, decimal expected, string? qualid = null, bool geb = false) {
private static void TestCalcOe(PaymentBillingData data, string bucket, double oe, decimal expected, string? qualid = null, bool ctrd = false) {
var (sortid, attrid, cultid) = GetSortIdAttrId(bucket);
var kmw = Utils.OeToKmw(oe);
var v = data.CalculatePrice(sortid, attrid, cultid, qualid ?? GetQualId(kmw), geb, oe, kmw);
var v = data.CalculatePrice(sortid, attrid, cultid, qualid ?? GetQualId(kmw), ctrd, oe, kmw);
Assert.That(Math.Round(v, 6), Is.EqualTo(expected));
}
private static void TestCalcKmw(PaymentBillingData data, string bucket, double kmw, decimal expected, string? qualid = null, bool geb = false) {
private static void TestCalcKmw(PaymentBillingData data, string bucket, double kmw, decimal expected, string? qualid = null, bool ctrd = false) {
var (sortid, attrid, cultid) = GetSortIdAttrId(bucket);
var oe = Utils.KmwToOe(kmw);
var v = data.CalculatePrice(sortid, attrid, cultid, qualid ?? GetQualId(kmw), geb, oe, kmw);
var v = data.CalculatePrice(sortid, attrid, cultid, qualid ?? GetQualId(kmw), ctrd, oe, kmw);
Assert.That(Math.Round(v, 6), Is.EqualTo(expected));
}
@@ -84,11 +84,11 @@ namespace Tests.UnitTests.HelperTests {
TestCalcOe(data, "GV", 80, 0.85m);
TestCalcOe(data, "GV", 83, 1.00m);
TestCalcOe(data, "GV", 90, 1.00m);
TestCalcOe(data, "GV", 73, 0.60m, geb: true);
TestCalcOe(data, "GV", 74, 0.65m, geb: true);
TestCalcOe(data, "GV", 80, 0.95m, geb: true);
TestCalcOe(data, "GV", 83, 1.10m, geb: true);
TestCalcOe(data, "GV", 90, 1.10m, geb: true);
TestCalcOe(data, "GV", 73, 0.60m, ctrd: true);
TestCalcOe(data, "GV", 74, 0.65m, ctrd: true);
TestCalcOe(data, "GV", 80, 0.95m, ctrd: true);
TestCalcOe(data, "GV", 83, 1.10m, ctrd: true);
TestCalcOe(data, "GV", 90, 1.10m, ctrd: true);
}
}
@@ -298,7 +298,7 @@ namespace Tests.UnitTests.HelperTests {
"73oe": 0.5,
"17kmw": 0.6
},
"geb": 0.1
"ctrd": 0.1
}, {
"id": 2,
"mode": "kmw",
@@ -306,7 +306,7 @@ namespace Tests.UnitTests.HelperTests {
"15kmw": 0.6,
"17kmw": 0.7
},
"geb": {
"ctrd": {
"73oe": 0.65,
"17kmw": 0.80
}
@@ -318,21 +318,21 @@ namespace Tests.UnitTests.HelperTests {
TestCalcKmw(data, "GVS", 15.0, 0.50m);
TestCalcKmw(data, "GVS", 16.0, 0.55m);
TestCalcKmw(data, "GVS", 17.0, 0.60m);
TestCalcKmw(data, "GVS", 15.0, 0.60m, geb: true);
TestCalcKmw(data, "GVS", 16.0, 0.65m, geb: true);
TestCalcKmw(data, "GVS", 17.0, 0.70m, geb: true);
TestCalcKmw(data, "GVS", 15.0, 0.60m, ctrd: true);
TestCalcKmw(data, "GVS", 16.0, 0.65m, ctrd: true);
TestCalcKmw(data, "GVS", 17.0, 0.70m, ctrd: true);
TestCalcKmw(data, "GVK", 15.0, 0.60m);
TestCalcKmw(data, "GVK", 16.0, 0.65m);
TestCalcKmw(data, "GVK", 17.0, 0.70m);
TestCalcKmw(data, "GVK", 15.0, 0.65m, geb: true);
TestCalcKmw(data, "GVK", 16.0, 0.725m, geb: true);
TestCalcKmw(data, "GVK", 17.0, 0.80m, geb: true);
TestCalcKmw(data, "GVK", 15.0, 0.65m, ctrd: true);
TestCalcKmw(data, "GVK", 16.0, 0.725m, ctrd: true);
TestCalcKmw(data, "GVK", 17.0, 0.80m, ctrd: true);
TestCalcKmw(data, "WRS", 15.0, 0.70m);
TestCalcKmw(data, "WRS", 16.0, 0.75m);
TestCalcKmw(data, "WRS", 17.0, 0.80m);
TestCalcKmw(data, "WRS", 15.0, 0.80m, geb: true);
TestCalcKmw(data, "WRS", 16.0, 0.875m, geb: true);
TestCalcKmw(data, "WRS", 17.0, 0.95m, geb: true);
TestCalcKmw(data, "WRS", 15.0, 0.80m, ctrd: true);
TestCalcKmw(data, "WRS", 16.0, 0.875m, ctrd: true);
TestCalcKmw(data, "WRS", 17.0, 0.95m, ctrd: true);
}
}
+26 -26
View File
@@ -11,12 +11,12 @@ namespace Tests.UnitTests.HelperTests {
private const int MgNr1 = 101, MgNr2 = 102, MgNr3 = 103, MgNr4 = 104;
private const decimal
GV_ungeb = 0.50m,
GV_geb = 0.60m,
GVB_ungeb = 0.54m,
GVB_geb = 0.64m,
GVK_ungeb = 0.61m,
GVK_geb = 0.71m,
GV_unctrd = 0.50m,
GV_ctrd = 0.60m,
GVB_unctrd = 0.54m,
GVB_ctrd = 0.64m,
GVK_unctrd = 0.61m,
GVK_ctrd = 0.71m,
WEI = 0.10m;
private SqliteConnection? Connection;
@@ -56,12 +56,12 @@ namespace Tests.UnitTests.HelperTests {
"id": 1,
"mode": "oe",
"data": {"15kmw": 0.54},
"geb": 0.1
"ctrd": 0.1
}, {
"id": 2,
"mode": "oe",
"data": {"15kmw": 0.61},
"geb": 0.1
"ctrd": 0.1
}]
}
""";
@@ -148,17 +148,17 @@ namespace Tests.UnitTests.HelperTests {
using (Assert.EnterMultipleScope()) {
Assert.That(prices, Has.Count.EqualTo(6));
// Kabinett
Assert.That(prices[("20201001X001/1", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
Assert.That(prices[("20201001X001/1", "GV_")], Is.EqualTo((4_000, GV_unctrd)));
// ohne Attribut
Assert.That(prices[("20201001X001/2", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
Assert.That(prices[("20201001X001/2", "GV_")], Is.EqualTo((4_000, GV_unctrd)));
// Bio
Assert.That(prices[("20201001X002/1", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
Assert.That(prices[("20201001X002/1", "GV_")], Is.EqualTo((4_000, GVB_unctrd)));
// Bio
Assert.That(prices[("20201001X002/2", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
Assert.That(prices[("20201001X002/2", "GV_")], Is.EqualTo((4_000, GVB_unctrd)));
// ohne Attribut
Assert.That(prices[("20201001X003/1", "GV_")], Is.EqualTo(( 500, WEI)));
// ohne Attribut
Assert.That(prices[("20201001X003/2", "GV_")], Is.EqualTo(( 500, GV_ungeb)));
Assert.That(prices[("20201001X003/2", "GV_")], Is.EqualTo(( 500, GV_unctrd)));
}
}
@@ -193,23 +193,23 @@ namespace Tests.UnitTests.HelperTests {
using (Assert.EnterMultipleScope()) {
Assert.That(prices, Has.Count.EqualTo(7));
// Kabinett
Assert.That(prices[("20211001X001/1", "GV")] , Is.EqualTo((4_000, GV_geb)));
Assert.That(prices[("20211001X001/1", "GV")] , Is.EqualTo((4_000, GV_ctrd)));
// ohne Attribut
Assert.That(prices[("20211001X001/2", "GV")], Is.EqualTo((4_000, GV_geb)));
Assert.That(prices[("20211001X001/2", "GV")], Is.EqualTo((4_000, GV_ctrd)));
// Bio
Assert.That(prices[("20211001X002/1", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
Assert.That(prices[("20211001X002/1", "GV_")], Is.EqualTo((4_000, GVB_unctrd)));
// Bio
Assert.That(prices[("20211001X002/2", "GV_")], Is.EqualTo((2_000, GVB_ungeb)));
Assert.That(prices[("20211001X002/2", "GV")], Is.EqualTo((2_000, GVB_geb)));
Assert.That(prices[("20211001X002/2", "GV_")], Is.EqualTo((2_000, GVB_unctrd)));
Assert.That(prices[("20211001X002/2", "GV")], Is.EqualTo((2_000, GVB_ctrd)));
// ohne Attribut
Assert.That(prices[("20211001X003/1", "GV_")], Is.EqualTo(( 500, WEI)));
// ohne Attribut
Assert.That(prices[("20211001X003/2", "GV_")], Is.EqualTo(( 500, GV_ungeb)));
Assert.That(prices[("20211001X003/2", "GV_")], Is.EqualTo(( 500, GV_unctrd)));
}
}
[Test]
public async Task Test_03_SimpleNotStrictAreaComs_HonorGebunden() {
public async Task Test_03_SimpleNotStrictAreaComs_HonorContracted() {
int mgnr = MgNr1, year = Year2;
var areaCom = await GetMemberAreaCommitmentBuckets(year, mgnr);
@@ -239,17 +239,17 @@ namespace Tests.UnitTests.HelperTests {
using (Assert.EnterMultipleScope()) {
Assert.That(prices, Has.Count.EqualTo(6));
// Kabinett
Assert.That(prices[("20211001X001/1", "GV")], Is.EqualTo((4_000, GV_geb)));
Assert.That(prices[("20211001X001/1", "GV")], Is.EqualTo((4_000, GV_ctrd)));
// ohne Attribut
Assert.That(prices[("20211001X001/2", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
Assert.That(prices[("20211001X001/2", "GV_")], Is.EqualTo((4_000, GV_unctrd)));
// Bio
Assert.That(prices[("20211001X002/1", "GV")], Is.EqualTo((4_000, GVB_geb)));
Assert.That(prices[("20211001X002/1", "GV")], Is.EqualTo((4_000, GVB_ctrd)));
// Bio
Assert.That(prices[("20211001X002/2", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
Assert.That(prices[("20211001X002/2", "GV_")], Is.EqualTo((4_000, GVB_unctrd)));
// ohne Attribut
Assert.That(prices[("20211001X003/1", "GV_")], Is.EqualTo(( 500, WEI)));
// ohne Attribut
Assert.That(prices[("20211001X003/2", "GV_")], Is.EqualTo(( 500, GV_ungeb)));
Assert.That(prices[("20211001X003/2", "GV_")], Is.EqualTo(( 500, GV_unctrd)));
}
}
@@ -262,7 +262,7 @@ namespace Tests.UnitTests.HelperTests {
[Test]
[Ignore("Not implemented yet")]
public Task Test_05_ComplexNotStrictAreaComs_HonorGebunden() {
public Task Test_05_ComplexNotStrictAreaComs_HonorContracted() {
// TODO
return Task.CompletedTask;
}
@@ -93,7 +93,7 @@ namespace Tests.UnitTests.ServiceTests {
vm.UstIdNr = "ATU12345693";
vm.LfbisNr = "0123498";
vm.IsBuchführend = true;
vm.IsAccounting = true;
vm.IsOrganic = true;
vm.BillingName = "Neue Holding AG";
@@ -107,8 +107,8 @@ namespace Tests.UnitTests.ServiceTests {
vm.Comment = "Ich bin eine Anmerkung";
vm.ContactViaPost = true;
vm.ContactViaEmail = true;
vm.IsVollLieferant = true;
vm.IsFunktionär = true;
vm.IsFullDelivery = true;
vm.IsOfficer = true;
using (var ctx = new AppDbContext()) {
Assert.That(await ctx.FetchMembers(999).SingleOrDefaultAsync(), Is.Null);
@@ -146,7 +146,7 @@ namespace Tests.UnitTests.ServiceTests {
Assert.That(m.UstIdNr, Is.EqualTo("ATU12345693"));
Assert.That(m.LfbisNr, Is.EqualTo("0123498"));
Assert.That(m.IsBuchführend, Is.True);
Assert.That(m.IsAccounting, Is.True);
Assert.That(m.IsOrganic, Is.True);
Assert.That(m.BillingAddress, Is.Not.Null);
@@ -161,8 +161,8 @@ namespace Tests.UnitTests.ServiceTests {
Assert.That(m.Comment, Is.EqualTo("Ich bin eine Anmerkung"));
Assert.That(m.ContactViaPost, Is.True);
Assert.That(m.ContactViaEmail, Is.True);
Assert.That(m.IsVollLieferant, Is.True);
Assert.That(m.IsFunktionär, Is.True);
Assert.That(m.IsFullDelivery, Is.True);
Assert.That(m.IsOfficer, Is.True);
}
vm = new MemberAdminViewModel();
@@ -194,7 +194,7 @@ namespace Tests.UnitTests.ServiceTests {
Assert.That(vm.UstIdNr, Is.EqualTo("ATU12345693"));
Assert.That(vm.LfbisNr, Is.EqualTo("0123498"));
Assert.That(vm.IsBuchführend, Is.True);
Assert.That(vm.IsAccounting, Is.True);
Assert.That(vm.IsOrganic, Is.True);
Assert.That(vm.BillingName, Is.EqualTo("Neue Holding AG"));
@@ -208,8 +208,8 @@ namespace Tests.UnitTests.ServiceTests {
Assert.That(vm.Comment, Is.EqualTo("Ich bin eine Anmerkung"));
Assert.That(vm.ContactViaPost, Is.True);
Assert.That(vm.ContactViaEmail, Is.True);
Assert.That(vm.IsVollLieferant, Is.True);
Assert.That(vm.IsFunktionär, Is.True);
Assert.That(vm.IsFullDelivery, Is.True);
Assert.That(vm.IsOfficer, Is.True);
}
}