[#20] Entities/MemberHistory: Add DeductYear to simplify billing

This commit is contained in:
2026-07-03 10:43:14 +02:00
parent a71c41af5c
commit 9a0a422c8a
8 changed files with 16 additions and 15 deletions
+2 -5
View File
@@ -101,11 +101,8 @@ namespace Elwig.Documents {
MemberTotalUnderDelivery -= (season.PenaltyNone ?? 0) + (season.PenaltyPerShareNone * (Member.Shares + Member.SharesRed + Member.SharesWhite) ?? 0);
}
if (ConsiderAutoBusinessShares) {
var fromDate = $"{season.Year}-01-01";
var toDate = $"{season.Year}-12-31";
MemberAutoBusinessShares = await ctx.MemberHistory
.Where(h => h.ToMgNr == Member.MgNr && h.Reason == "auto")
.Where(h => h.DateString.CompareTo(fromDate) >= 0 && h.DateString.CompareTo(toDate) <= 0)
.Where(h => h.ToMgNr == Member.MgNr && h.DeductYear == season.Year)
.SumAsync(h => h.Shares);
MemberAutoBusinessSharesAmount = MemberAutoBusinessShares * (-season.BusinessShareValue ?? 0);
}
@@ -205,7 +202,7 @@ namespace Elwig.Documents {
penalty += MemberTotalUnderDelivery;
}
if (MemberAutoBusinessSharesAmount != 0) {
tbl2.AddCells(FormatRow($"Autom. Nachz. von GA ({MemberAutoBusinessShares})", MemberAutoBusinessSharesAmount, add: true));
tbl2.AddCells(FormatRow($"Nachzeichnung von GA ({MemberAutoBusinessShares})", MemberAutoBusinessSharesAmount, add: true));
penalty += MemberAutoBusinessSharesAmount;
}
if (CustomPayment?.Amount != null) {