[#20][#80] Elwig: Update member_history and add different types of shares
Test / Run tests (push) Successful in 2m31s
Test / Run tests (push) Successful in 2m31s
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Elwig.Models.Dtos {
|
||||
("Gross", "Brutto", "€", 20),
|
||||
("Penalties", "Pönalen FB", "€", 20),
|
||||
("Penalty", "Unterl. GA", "€", 20),
|
||||
("AutoBs", "GA Nachz.", "€", 20),
|
||||
("AutoShares", "GA Nachz.", "€", 20),
|
||||
("Custom", "Weitere", "€", 20),
|
||||
("Others", "Sonstige", "€", 20),
|
||||
("Considered", "Berückstgt.", "€", 20),
|
||||
@@ -56,9 +56,9 @@ namespace Elwig.Models.Dtos {
|
||||
p.plz, o.name AS ort, m.address, m.iban, c.tgnr, s.year, s.precision,
|
||||
p.amount - p.net_amount AS surcharge,
|
||||
c.net_amount, c.prev_net_amount, c.vat, c.vat_amount, c.gross_amount, c.modifiers, c.prev_modifiers, c.amount,
|
||||
ROUND(b.total_penalty / POW(10, s.precision - 2)) AS bs_penalty,
|
||||
ROUND(u.total_penalty / POW(10, 4 - 2)) AS fb_penalty,
|
||||
ROUND(-a.total_amount / POW(10, s.precision - 2)) AS auto_bs,
|
||||
ROUND(b.total_penalty / POW(10, s.precision - 2)) AS shares_penalty,
|
||||
ROUND(u.total_penalty / POW(10, 4 - 2)) AS ac_penalty,
|
||||
-a.total_amount AS auto_shares,
|
||||
x.amount AS custom_mod
|
||||
FROM credit c
|
||||
LEFT JOIN member m ON m.mgnr = c.mgnr
|
||||
@@ -94,7 +94,7 @@ namespace Elwig.Models.Dtos {
|
||||
public decimal Gross;
|
||||
public decimal? Penalties;
|
||||
public decimal? Penalty;
|
||||
public decimal? AutoBs;
|
||||
public decimal? AutoShares;
|
||||
public decimal? Custom;
|
||||
public decimal? Others;
|
||||
public decimal? Considered;
|
||||
@@ -122,14 +122,14 @@ namespace Elwig.Models.Dtos {
|
||||
}
|
||||
decimal mod = (row.Modifiers == null) ? 0 : Utils.DecFromDb((long)row.Modifiers, prec1);
|
||||
if (data.ConsiderContractPenalties)
|
||||
Penalties = (row.FbPenalty == null) ? null : Utils.DecFromDb((long)row.FbPenalty, prec1);
|
||||
Penalties = (row.AcPenalty == null) ? null : Utils.DecFromDb((long)row.AcPenalty, prec1);
|
||||
if (data.ConsiderTotalPenalty)
|
||||
Penalty = (row.BsPenalty == null) ? null : Utils.DecFromDb((long)row.BsPenalty, prec1);
|
||||
Penalty = (row.SharesPenalty == null) ? null : Utils.DecFromDb((long)row.SharesPenalty, prec1);
|
||||
if (data.ConsiderAutoBusinessShares)
|
||||
AutoBs = (row.AutoBs == null) ? null : Utils.DecFromDb((long)row.AutoBs, prec1);
|
||||
AutoShares = (row.AutoShares == null) ? null : Utils.DecFromDb((long)row.AutoShares, prec1);
|
||||
if (data.ConsiderCustomModifiers)
|
||||
Custom = (row.CustomMod == null) ? null : Utils.DecFromDb((long)row.CustomMod, prec1);
|
||||
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoBs ?? 0) + (Custom ?? 0);
|
||||
mod -= (Penalties ?? 0) + (Penalty ?? 0) + (AutoShares ?? 0) + (Custom ?? 0);
|
||||
Others = (mod == 0) ? null : mod;
|
||||
Gross = Utils.DecFromDb(row.GrossAmount, prec1);
|
||||
Considered = (row.PrevModifiers == null || row.PrevModifiers == 0) ? null : -Utils.DecFromDb((long)row.PrevModifiers, prec1);
|
||||
@@ -179,12 +179,12 @@ namespace Elwig.Models.Dtos {
|
||||
public long? PrevModifiers { get; set; }
|
||||
[Column("amount")]
|
||||
public long Amount { get; set; }
|
||||
[Column("bs_penalty")]
|
||||
public long? BsPenalty { get; set; }
|
||||
[Column("fb_penalty")]
|
||||
public long? FbPenalty { get; set; }
|
||||
[Column("auto_bs")]
|
||||
public long? AutoBs { get; set; }
|
||||
[Column("shares_penalty")]
|
||||
public long? SharesPenalty { get; set; }
|
||||
[Column("ac_penalty")]
|
||||
public long? AcPenalty { get; set; }
|
||||
[Column("auto_shares")]
|
||||
public long? AutoShares { get; set; }
|
||||
[Column("custom_mod")]
|
||||
public long? CustomMod { get; set; }
|
||||
}
|
||||
|
||||
@@ -42,13 +42,10 @@ namespace Elwig.Models.Dtos {
|
||||
}
|
||||
|
||||
private static async Task<IEnumerable<CreditNoteDeliveryRowSingle>> FromDbSet(DbSet<CreditNoteDeliveryRowSingle> table, int? year = null, int? avnr = null, int? mgnr = null) {
|
||||
var y = year?.ToString() ?? "NULL";
|
||||
var v = avnr?.ToString() ?? "NULL";
|
||||
var m = mgnr?.ToString() ?? "NULL";
|
||||
return await table.FromSqlRaw($"""
|
||||
return await table.FromSql($"""
|
||||
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 variety, a.name AS attribute, c.name AS cultivation, q.qualid AS qualid, q.name AS quality_level, d.oe, d.kmw, d.net_weight
|
||||
s.name AS variety, s.type AS type, a.name AS attribute, c.name AS cultivation, q.qualid AS qualid, q.name AS quality_level, d.oe, d.kmw, d.net_weight
|
||||
FROM v_delivery d
|
||||
JOIN wine_variety s ON s.sortid = d.sortid
|
||||
LEFT JOIN wine_attribute a ON a.attrid = d.attrid
|
||||
@@ -59,7 +56,7 @@ namespace Elwig.Models.Dtos {
|
||||
LEFT JOIN payment_delivery_part p ON (p.year, p.did, p.dpnr, p.avnr) = (d.year, d.did, d.dpnr, v.avnr)
|
||||
LEFT JOIN payment_delivery_part_bucket pb ON (pb.year, pb.did, pb.dpnr, pb.bktnr, pb.avnr) = (b.year, b.did, b.dpnr, b.bktnr, v.avnr)
|
||||
LEFT JOIN credit c ON (c.year, c.avnr, c.mgnr) = (d.year, v.avnr, d.mgnr)
|
||||
WHERE b.value > 0 AND (d.year = {y} OR {y} IS NULL) AND (v.avnr = {v} OR {v} IS NULL) AND (d.mgnr = {m} OR {m} IS NULL)
|
||||
WHERE b.value > 0 AND (d.year = {year} OR {year} IS NULL) AND (v.avnr = {avnr} OR {avnr} IS NULL) AND (d.mgnr = {mgnr} OR {mgnr} IS NULL)
|
||||
ORDER BY d.year, v.avnr, d.mgnr, d.lsnr, d.dpnr
|
||||
""").ToListAsync();
|
||||
}
|
||||
@@ -75,6 +72,7 @@ namespace Elwig.Models.Dtos {
|
||||
public string LsNr;
|
||||
public int DPNr;
|
||||
public string Variety;
|
||||
public string Type;
|
||||
public string? Attribute;
|
||||
public string? Cultivation;
|
||||
public string[] Modifiers;
|
||||
@@ -97,24 +95,24 @@ namespace Elwig.Models.Dtos {
|
||||
LsNr = f.LsNr;
|
||||
DPNr = f.DPNr;
|
||||
Variety = f.Variety;
|
||||
Type = f.Type;
|
||||
Attribute = f.Attribute;
|
||||
Cultivation = f.Cultivation;
|
||||
var modifiers = (IEnumerable<Modifier>)(f.Modifiers ?? "").Split(',')
|
||||
.Select(m => season?.Modifiers.FirstOrDefault(s => s.ModId == m))
|
||||
.Where(m => m != null)
|
||||
.OrderBy(m => m.Ordering)
|
||||
.OrderBy(m => m!.Ordering)
|
||||
.ToList();
|
||||
Modifiers = modifiers.Select(m => m.Name).ToArray();
|
||||
Modifiers = [.. modifiers.Select(m => m.Name)];
|
||||
QualId = f.QualId;
|
||||
QualityLevel = f.QualityLevel;
|
||||
Gradation = (f.Oe, f.Kmw);
|
||||
Buckets = rows
|
||||
Buckets = [.. rows
|
||||
.Where(b => b.Value > 0)
|
||||
.OrderByDescending(b => b.BktNr)
|
||||
.Select(b => (b.Discr == "_" ? "ungeb." : $"geb. {f.SortId}{b.Discr}", b.Value,
|
||||
b.Price != null ? season?.DecFromDb((long)b.Price) : null,
|
||||
b.Amount != null ? season?.DecFromDb((long)b.Amount) : null))
|
||||
.ToArray();
|
||||
b.Amount != null ? season?.DecFromDb((long)b.Amount) : null))];
|
||||
WeighingModifier = (varData == null || !varData.ConsiderDelieryModifiers) ? 0 : f.NetWeight ? varData.NetWeightModifier : varData.GrossWeightModifier;
|
||||
Amount = f.TotalAmount != null ? season?.DecFromDb((long)f.TotalAmount) : null;
|
||||
var netAmount = f.NetAmount != null ? season?.DecFromDb((long)f.NetAmount) : null;
|
||||
@@ -161,6 +159,8 @@ namespace Elwig.Models.Dtos {
|
||||
public long? TotalAmount { get; set; }
|
||||
[Column("variety")]
|
||||
public required string Variety { get; set; }
|
||||
[Column("type")]
|
||||
public required string Type { get; set; }
|
||||
[Column("attribute")]
|
||||
public string? Attribute { get; set; }
|
||||
[Column("cultivation")]
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Elwig.Models.Dtos {
|
||||
public class MemberDeliveryData : DataTable<MemberDeliveryRow> {
|
||||
|
||||
private static readonly (string, string, string?, int?)[] FieldNames = [
|
||||
("MgNr", "MgNr.", null, 12),
|
||||
("MgNr", "MgNr.", null, 12),
|
||||
("Name1", "Name", null, 40),
|
||||
("Name2", "Vorname", null, 40),
|
||||
("Address", "Adresse", null, 60),
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Elwig.Models.Dtos {
|
||||
("Locality", "Ort", null, 60),
|
||||
("DefaultKg", "Stammgemeinde", null, 60),
|
||||
("Branch", "Zweigstelle", null, 40),
|
||||
("BusinessShares", "GA", null, 10),
|
||||
("SharesTotal", "GA", null, 10),
|
||||
("BillingName", "Rechnungsname", null, 60),
|
||||
("BillingAddress", "Rechnungsadresse", null, 60),
|
||||
("BillingPlz", "PLZ", null, 10),
|
||||
@@ -66,7 +66,11 @@ namespace Elwig.Models.Dtos {
|
||||
public string? Name2;
|
||||
public string? DefaultKg;
|
||||
public string? Branch;
|
||||
public int BusinessShares;
|
||||
public int Shares;
|
||||
public int SharesRed;
|
||||
public int SharesWhite;
|
||||
public int SharesDormant;
|
||||
public int SharesTotal;
|
||||
public string Address;
|
||||
public int Plz;
|
||||
public string Locality;
|
||||
@@ -98,7 +102,11 @@ namespace Elwig.Models.Dtos {
|
||||
Name2 = m.AdministrativeName2;
|
||||
DefaultKg = m.DefaultKg?.Name;
|
||||
Branch = m.Branch?.Name;
|
||||
BusinessShares = m.BusinessShares;
|
||||
Shares = m.Shares;
|
||||
SharesRed = m.SharesRed;
|
||||
SharesWhite = m.SharesWhite;
|
||||
SharesDormant = m.SharesDormant;
|
||||
SharesTotal = Shares + SharesRed + SharesWhite + SharesDormant;
|
||||
Address = m.Address;
|
||||
Plz = m.PostalDest.AtPlz!.Plz;
|
||||
Locality = m.PostalDest.AtPlz!.Ort.Name;
|
||||
|
||||
@@ -13,33 +13,72 @@ namespace Elwig.Models.Dtos {
|
||||
("Address", "Adresse", null, 60),
|
||||
("Plz", "PLZ", null, 10),
|
||||
("Locality", "Ort", null, 60),
|
||||
("BusinessShares", "GA", null, 10),
|
||||
("Shares", "GA", null, 10),
|
||||
("DeliveryObligation", "Lieferpflicht", "kg", 22),
|
||||
("DeliveryRight", "Lieferrecht", "kg", 22),
|
||||
("Weight", "Geliefert", "kg", 22),
|
||||
("WeightTotal", "Geliefert", "kg", 22),
|
||||
("OverUnderDelivery", "Über-/Unterliefert", "kg|%", 34),
|
||||
];
|
||||
|
||||
private static readonly (string, string, string?, int)[] FieldNamesRed = [
|
||||
("MgNr", "MgNr.", null, 12),
|
||||
("Name1", "Name", null, 40),
|
||||
("Name2", "Vorname", null, 40),
|
||||
("Address", "Adresse", null, 60),
|
||||
("Plz", "PLZ", null, 10),
|
||||
("Locality", "Ort", null, 60),
|
||||
("SharesRed", "GA", null, 10),
|
||||
("DeliveryObligationRed", "Lieferpflicht", "kg", 22),
|
||||
("DeliveryRightRed", "Lieferrecht", "kg", 22),
|
||||
("WeightRed", "Geliefert", "kg", 22),
|
||||
("OverUnderDeliveryRed", "Über-/Unterliefert", "kg|%", 34),
|
||||
];
|
||||
|
||||
private static readonly (string, string, string?, int)[] FieldNamesWhite = [
|
||||
("MgNr", "MgNr.", null, 12),
|
||||
("Name1", "Name", null, 40),
|
||||
("Name2", "Vorname", null, 40),
|
||||
("Address", "Adresse", null, 60),
|
||||
("Plz", "PLZ", null, 10),
|
||||
("Locality", "Ort", null, 60),
|
||||
("SharesWhite", "GA", null, 10),
|
||||
("DeliveryObligationWhite", "Lieferpflicht", "kg", 22),
|
||||
("DeliveryRightWhite", "Lieferrecht", "kg", 22),
|
||||
("WeightWhite", "Geliefert", "kg", 22),
|
||||
("OverUnderDeliveryWhite", "Über-/Unterliefert", "kg|%", 34),
|
||||
];
|
||||
|
||||
public OverUnderDeliveryData(IEnumerable<OverUnderDeliveryRow> rows, int year) :
|
||||
base($"Über-Unterlieferungen", $"Über- und Unterlieferungen laut gezeichneten Geschäftsanteilen {year}", rows, FieldNames) {
|
||||
}
|
||||
|
||||
public OverUnderDeliveryData(IEnumerable<OverUnderDeliveryRow> rows, int year, string mode) :
|
||||
base($"Über-Unterlieferungen", $"Über- und Unterlieferungen laut gezeichneten Geschäftsanteilen {(mode == "R" ? "rot" : "weiß")} {year}", rows,
|
||||
mode == "R" ? FieldNamesRed : FieldNamesWhite) {
|
||||
}
|
||||
|
||||
public static async Task<OverUnderDeliveryData> ForSeason(DbSet<OverUnderDeliveryRow> table, int year) {
|
||||
var rows = await table.FromSql($"""
|
||||
SELECT m.mgnr, m.name AS name_1,
|
||||
COALESCE(m.prefix || ' ', '') || m.given_name ||
|
||||
COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '') AS name_2,
|
||||
p.plz, o.name AS ort, m.address, m.business_shares,
|
||||
m.business_shares * s.min_kg_per_bs AS min_kg,
|
||||
m.business_shares * s.max_kg_per_bs AS max_kg,
|
||||
COALESCE(SUM(d.weight), 0) AS sum
|
||||
p.plz, o.name AS ort, m.address, h.shares, h.shares_red, h.shares_white,
|
||||
h.shares * COALESCE(s.min_kg_per_share, 0) AS min_kg,
|
||||
h.shares * COALESCE(s.max_kg_per_share, 0) AS max_kg,
|
||||
h.shares_red * COALESCE(s.min_kg_per_share_red, s.min_kg_per_share, 0) AS min_kg_red,
|
||||
h.shares_red * COALESCE(s.max_kg_per_share_red, s.max_kg_per_share, 0) AS max_kg_red,
|
||||
h.shares_white * COALESCE(s.min_kg_per_share_white, s.min_kg_per_share, 0) AS min_kg_white,
|
||||
h.shares_white * COALESCE(s.max_kg_per_share_white, s.max_kg_per_share, 0) AS max_kg_white,
|
||||
COALESCE(d.weight_total, 0) AS weight_total,
|
||||
COALESCE(d.weight_red, 0) AS weight_red,
|
||||
COALESCE(d.weight_white, 0) AS weight_white
|
||||
FROM season s, member m
|
||||
LEFT JOIN AT_plz_dest p ON p.id = m.postal_dest
|
||||
LEFT JOIN AT_ort o ON o.okz = p.okz
|
||||
LEFT JOIN v_delivery d ON (d.year, d.mgnr) = (s.year, m.mgnr)
|
||||
WHERE s.year = {year} AND (m.active = TRUE OR d.weight > 0)
|
||||
GROUP BY s.year, m.mgnr
|
||||
ORDER BY 100.0 * sum / max_kg, m.mgnr
|
||||
LEFT JOIN v_member_history h ON (h.year, h.mgnr) = (s.year, m.mgnr)
|
||||
LEFT JOIN v_stat_member d ON (d.year, d.mgnr) = (s.year, m.mgnr)
|
||||
WHERE s.year = {year} AND (m.active = TRUE OR d.weight_total > 0)
|
||||
ORDER BY 100.0 * weight_total / (max_kg + max_kg_red + max_kg_white), m.mgnr
|
||||
""").ToListAsync();
|
||||
return new OverUnderDeliveryData(rows, year);
|
||||
}
|
||||
@@ -61,17 +100,41 @@ namespace Elwig.Models.Dtos {
|
||||
public required string LocalityFull { get; set; }
|
||||
[NotMapped]
|
||||
public string Locality => LocalityFull.Split(",")[0];
|
||||
[Column("business_shares")]
|
||||
public int BusinessShares { get; set; }
|
||||
[Column("shares")]
|
||||
public int Shares { get; set; }
|
||||
[Column("shares_red")]
|
||||
public int SharesRed { get; set; }
|
||||
[Column("shares_white")]
|
||||
public int SharesWhite { get; set; }
|
||||
[Column("min_kg")]
|
||||
public int DeliveryObligation { get; set; }
|
||||
[Column("max_kg")]
|
||||
public int DeliveryRight { get; set; }
|
||||
[Column("sum")]
|
||||
public int Weight { get; set; }
|
||||
[NotMapped]
|
||||
public (int? Kg, double? Percent) OverUnderDelivery =>
|
||||
Weight < DeliveryObligation ? (Weight - DeliveryObligation, Weight * 100.0 / DeliveryObligation - 100.0) :
|
||||
Weight > DeliveryRight ? (Weight - DeliveryRight, Weight * 100.0 / DeliveryRight - 100.0) : (null, null);
|
||||
WeightTotal < DeliveryObligation ? (WeightTotal - DeliveryObligation, WeightTotal * 100.0 / DeliveryObligation - 100.0) :
|
||||
WeightTotal > DeliveryRight ? (WeightTotal - DeliveryRight, WeightTotal * 100.0 / DeliveryRight - 100.0) : (null, null);
|
||||
[Column("min_kg_red")]
|
||||
public int DeliveryObligationRed { get; set; }
|
||||
[Column("max_kg_red")]
|
||||
public int DeliveryRightRed { get; set; }
|
||||
[NotMapped]
|
||||
public (int? Kg, double? Percent) OverUnderDeliveryRed =>
|
||||
WeightRed < DeliveryObligationRed ? (WeightRed - DeliveryObligationRed, WeightRed * 100.0 / DeliveryObligationRed - 100.0) :
|
||||
WeightRed > DeliveryRightRed ? (WeightRed - DeliveryRightRed, WeightRed * 100.0 / DeliveryRightRed - 100.0) : (null, null);
|
||||
[Column("min_kg_white")]
|
||||
public int DeliveryObligationWhite { get; set; }
|
||||
[Column("max_kg_white")]
|
||||
public int DeliveryRightWhite { get; set; }
|
||||
[NotMapped]
|
||||
public (int? Kg, double? Percent) OverUnderDeliveryWhite =>
|
||||
WeightWhite < DeliveryObligationWhite ? (WeightWhite - DeliveryObligationWhite, WeightWhite * 100.0 / DeliveryObligationWhite - 100.0) :
|
||||
WeightWhite > DeliveryRightWhite ? (WeightWhite - DeliveryRightWhite, WeightWhite * 100.0 / DeliveryRightWhite - 100.0) : (null, null);
|
||||
[Column("weight_total")]
|
||||
public int WeightTotal { get; set; }
|
||||
[Column("weight_red")]
|
||||
public int WeightRed { get; set; }
|
||||
[Column("weight_white")]
|
||||
public int WeightWhite { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,22 @@ namespace Elwig.Models.Entities {
|
||||
set => ExitDateString = value?.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
[Column("business_shares")]
|
||||
public int BusinessShares { get; set; }
|
||||
[Column("shares")]
|
||||
public int Shares { get; set; }
|
||||
|
||||
[Column("shares_red")]
|
||||
public int SharesRed { get; set; }
|
||||
|
||||
[Column("shares_white")]
|
||||
public int SharesWhite { get; set; }
|
||||
|
||||
[Column("shares_dormant")]
|
||||
public int SharesDormant { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public int SharesTotal => Shares + SharesRed + SharesWhite + SharesDormant;
|
||||
[NotMapped]
|
||||
public int SharesActive => Shares + SharesRed + SharesWhite;
|
||||
|
||||
[Column("accounting_nr")]
|
||||
public string? AccountingNr { get; set; }
|
||||
@@ -189,9 +203,14 @@ namespace Elwig.Models.Entities {
|
||||
[InverseProperty(nameof(BillingAddr.Member))]
|
||||
public virtual BillingAddr? BillingAddress { get; private set; }
|
||||
|
||||
[InverseProperty(nameof(Delivery.Member))]
|
||||
[InverseProperty(nameof(DeliveryAncmt.Member))]
|
||||
public virtual ICollection<DeliveryAncmt> Announcements { get; private set; } = null!;
|
||||
|
||||
[InverseProperty(nameof(MemberHistory.FromMember))]
|
||||
public virtual ICollection<MemberHistory> HistoryFrom { get; private set; } = null!;
|
||||
[InverseProperty(nameof(MemberHistory.ToMember))]
|
||||
public virtual ICollection<MemberHistory> HistoryTo { get; private set; } = null!;
|
||||
|
||||
[InverseProperty(nameof(Delivery.Member))]
|
||||
public virtual ICollection<Delivery> Deliveries { get; private set; } = null!;
|
||||
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
using Elwig.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
[Table("member_history"), PrimaryKey("MgNr", "DateString", "Type")]
|
||||
[Table("member_history"), PrimaryKey("HistNr")]
|
||||
public class MemberHistory {
|
||||
[Column("mgnr")]
|
||||
public int MgNr { get; set; }
|
||||
[Column("histnr")]
|
||||
public int HistNr { get; set; }
|
||||
|
||||
[Column("from_mgnr")]
|
||||
public int? FromMgNr { get; set; }
|
||||
[Column("from_type")]
|
||||
public int? FromType { get; set; }
|
||||
|
||||
[Column("to_mgnr")]
|
||||
public int? ToMgNr { get; set; }
|
||||
[Column("to_type")]
|
||||
public int? ToType { get; set; }
|
||||
|
||||
[Column("date")]
|
||||
public required string DateString { get; set; }
|
||||
@@ -16,16 +27,39 @@ namespace Elwig.Models.Entities {
|
||||
set => value.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
[Column("type")]
|
||||
public required string Type { get; set; }
|
||||
[Column("reason")]
|
||||
public required string Reason { get; set; }
|
||||
|
||||
[Column("business_shares")]
|
||||
public int BusinessShares { get; set; }
|
||||
[Column("source")]
|
||||
public required string Source { get; set; }
|
||||
|
||||
[Column("shares")]
|
||||
public int Shares { get; set; }
|
||||
|
||||
[Column("value_per_share")]
|
||||
public long? ValuePerShareValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? ValuePerShare {
|
||||
get => ValuePerShareValue != null ? Utils.DecFromDb(ValuePerShareValue.Value, 2) : null;
|
||||
set => ValuePerShareValue = value != null ? Utils.DecToDb(value.Value, 2) : null;
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public decimal? TotalValue => Shares * ValuePerShare;
|
||||
|
||||
[Column("currency")]
|
||||
public string? CurrencyCode { get; set; }
|
||||
|
||||
[Column("comment")]
|
||||
public string? Comment { get; set; }
|
||||
|
||||
[ForeignKey("MgNr")]
|
||||
public virtual Member Member { get; private set; } = null!;
|
||||
[ForeignKey("FromMgNr")]
|
||||
public virtual Member FromMember { get; private set; } = null!;
|
||||
|
||||
[ForeignKey("ToMgNr")]
|
||||
public virtual Member ToMember { get; private set; } = null!;
|
||||
|
||||
[ForeignKey("CurrencyCode")]
|
||||
public virtual Currency Currency { get; private set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,20 @@ namespace Elwig.Models.Entities {
|
||||
[Column("vat_flatrate")]
|
||||
public double VatFlatrate { get; set; }
|
||||
|
||||
[Column("min_kg_per_bs")]
|
||||
public int MinKgPerBusinessShare { get; set; }
|
||||
[Column("min_kg_per_share")]
|
||||
public int? MinKgPerShare { get; set; }
|
||||
[Column("max_kg_per_share")]
|
||||
public int? MaxKgPerShare { get; set; }
|
||||
|
||||
[Column("max_kg_per_bs")]
|
||||
public int MaxKgPerBusinessShare { get; set; }
|
||||
[Column("min_kg_per_share_red")]
|
||||
public int? MinKgPerShareRed { get; set; }
|
||||
[Column("max_kg_per_share_red")]
|
||||
public int? MaxKgPerShareRed { get; set; }
|
||||
|
||||
[Column("min_kg_per_share_white")]
|
||||
public int? MinKgPerShareWhite { get; set; }
|
||||
[Column("max_kg_per_share_white")]
|
||||
public int? MaxKgPerShareWhite { get; set; }
|
||||
|
||||
[Column("penalty_per_kg")]
|
||||
public long? PenaltyPerKgValue { get; set; }
|
||||
@@ -55,23 +64,23 @@ namespace Elwig.Models.Entities {
|
||||
set => PenaltyNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||
}
|
||||
|
||||
[Column("penalty_per_bs_amount")]
|
||||
public long? PenaltyPerBsAmountValue { get; set; }
|
||||
[Column("penalty_per_share_amount")]
|
||||
public long? PenaltyPerShareAmountValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyPerBsAmount {
|
||||
get => PenaltyPerBsAmountValue != null ? DecFromDb(PenaltyPerBsAmountValue.Value) : null;
|
||||
set => PenaltyPerBsAmountValue = value != null ? DecToDb(value.Value) : null;
|
||||
public decimal? PenaltyPerShareAmount {
|
||||
get => PenaltyPerShareAmountValue != null ? DecFromDb(PenaltyPerShareAmountValue.Value) : null;
|
||||
set => PenaltyPerShareAmountValue = value != null ? DecToDb(value.Value) : null;
|
||||
}
|
||||
|
||||
[Column("penalty_per_bs_none")]
|
||||
public long? PenaltyPerBsNoneValue { get; set; }
|
||||
[Column("penalty_per_share_none")]
|
||||
public long? PenaltyPerShareNoneValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? PenaltyPerBsNone {
|
||||
get => PenaltyPerBsNoneValue != null ? DecFromDb(PenaltyPerBsNoneValue.Value) : null;
|
||||
set => PenaltyPerBsNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||
public decimal? PenaltyPerShareNone {
|
||||
get => PenaltyPerShareNoneValue != null ? DecFromDb(PenaltyPerShareNoneValue.Value) : null;
|
||||
set => PenaltyPerShareNoneValue = value != null ? DecToDb(value.Value) : null;
|
||||
}
|
||||
|
||||
[Column("bs_value")]
|
||||
[Column("share_value")]
|
||||
public long? BusinessShareValueValue { get; set; }
|
||||
[NotMapped]
|
||||
public decimal? BusinessShareValue {
|
||||
|
||||
Reference in New Issue
Block a user