@ -39,13 +39,7 @@ namespace Elwig.Documents {
|
||||
return "";
|
||||
}
|
||||
|
||||
private enum RowMode {
|
||||
GA_CONFIRMATION, CONFIRMATION, GA_NOTE, NOTE
|
||||
}
|
||||
|
||||
private static string FormatRow(RowMode mode, int obligation, int right, int delivery, int? payment = null) {
|
||||
var isGa = (mode == RowMode.GA_CONFIRMATION || mode == RowMode.GA_NOTE);
|
||||
var showPayment = (mode == RowMode.GA_CONFIRMATION || mode == RowMode.CONFIRMATION);
|
||||
private static string FormatRow(int obligation, int right, int delivery, int? payment = null, bool isGa = false, bool showPayment = false) {
|
||||
payment ??= delivery;
|
||||
var baseline = showPayment ? payment : delivery;
|
||||
return $"<td>{(obligation == 0 ? "-" : $"{obligation:N0}")}</td>" +
|
||||
@ -57,8 +51,8 @@ namespace Elwig.Documents {
|
||||
$"<td>{delivery:N0}</td>";
|
||||
}
|
||||
|
||||
private static string FormatRow(RowMode mode, MemberBucket bucket) {
|
||||
return FormatRow(mode, bucket.Obligation, bucket.Right, bucket.Delivery, bucket.Payment);
|
||||
private static string FormatRow(MemberBucket bucket, bool isGa = false, bool showPayment = false) {
|
||||
return FormatRow(bucket.Obligation, bucket.Right, bucket.Delivery, bucket.Payment, isGa, showPayment);
|
||||
}
|
||||
|
||||
public string PrintBucketTable(Season season, Dictionary<string, MemberBucket> buckets, bool includePayment = false, bool isTiny = false, IEnumerable<string>? filter = null) {
|
||||
@ -99,23 +93,23 @@ namespace Elwig.Documents {
|
||||
|
||||
tbl += "\n<tbody>\n";
|
||||
tbl += $"<tr><th>Gesamtlieferung lt. gez. GA</th>{FormatRow(
|
||||
includePayment ? RowMode.GA_CONFIRMATION : RowMode.GA_NOTE,
|
||||
Member.BusinessShares * season.MinKgPerBusinessShare,
|
||||
Member.BusinessShares * season.MaxKgPerBusinessShare,
|
||||
Member.Deliveries.Where(d => d.Year == season.Year).Sum(d => d.Weight)
|
||||
Member.Deliveries.Where(d => d.Year == season.Year).Sum(d => d.Weight),
|
||||
isGa: true, showPayment: includePayment
|
||||
)}</tr>";
|
||||
if (fbs.Any()) {
|
||||
tbl += $"<tr class=\"subheading{(filter == null ? " border" : "")}\"><th colspan=\"{(includePayment ? 8 : 7)}\">" +
|
||||
$"Flächenbindungen{(vtr.Any() ? " (inkl. Verträge)" : "")}:</th></tr>";
|
||||
foreach (var (id, b) in fbs) {
|
||||
tbl += $"<tr><th>{b.Name}</th>{FormatRow(includePayment ? RowMode.CONFIRMATION : RowMode.NOTE, b)}</tr>";
|
||||
tbl += $"<tr><th>{b.Name}</th>{FormatRow(b, showPayment: includePayment)}</tr>";
|
||||
}
|
||||
}
|
||||
if (vtr.Any()) {
|
||||
tbl += $"<tr class=\"subheading{(filter == null ? " border" : "")}\"><th colspan=\"{(includePayment ? 8 : 7)}\">" +
|
||||
"Verträge:</th></tr>";
|
||||
foreach (var (id, b) in vtr) {
|
||||
tbl += $"<tr><th>{b.Name}</th>{FormatRow(includePayment ? RowMode.CONFIRMATION : RowMode.NOTE, b)}</tr>";
|
||||
tbl += $"<tr><th>{b.Name}</th>{FormatRow(b, showPayment: includePayment)}</tr>";
|
||||
}
|
||||
}
|
||||
tbl += "\n</tbody>\n";
|
||||
|
Reference in New Issue
Block a user