Billing: Add feature to calculate member/delivery bins
This commit is contained in:
@ -206,13 +206,13 @@ namespace Elwig.Helpers {
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<(string, string, int, int, int)>> GetMemberBuckets(Member m, int year) {
|
||||
public async Task<IEnumerable<(string, string, int, int, int)>> GetMemberBins(Member m, int year) {
|
||||
using var cnx = await ConnectAsync();
|
||||
var (rights, obligations) = await Billing.Billing.GetMemberRightsObligations(m.MgNr, year, cnx);
|
||||
var buckets = await Billing.Billing.GetMemberBucketWeights(m.MgNr, year, cnx);
|
||||
var bins = await Billing.Billing.GetMemberBinWeights(m.MgNr, year, cnx);
|
||||
|
||||
var list = new List<(string, string, int, int, int)>();
|
||||
foreach (var id in rights.Keys.Union(obligations.Keys).Union(buckets.Keys)) {
|
||||
foreach (var id in rights.Keys.Union(obligations.Keys).Union(bins.Keys)) {
|
||||
var s = await WineVarieties.FindAsync(id[..2]);
|
||||
var attrIds = id[2..];
|
||||
var a = await WineAttributes.Where(a => attrIds.Contains(a.AttrId)).ToListAsync();
|
||||
@ -221,7 +221,7 @@ namespace Elwig.Helpers {
|
||||
id, name,
|
||||
rights.TryGetValue(id, out var v1) ? v1 : 0,
|
||||
obligations.TryGetValue(id, out var v2) ? v2 : 0,
|
||||
buckets.TryGetValue(id, out var v3) ? v3 : 0
|
||||
bins.TryGetValue(id, out var v3) ? v3 : 0
|
||||
));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user