CreditNote: Add member modifier display
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Models.Dtos;
|
||||
using Elwig.Models.Entities;
|
||||
using System.Linq;
|
||||
|
||||
namespace Elwig.Documents {
|
||||
public class CreditNote : BusinessDocument {
|
||||
@ -11,6 +12,7 @@ namespace Elwig.Documents {
|
||||
public string? Text;
|
||||
public string CurrencySymbol;
|
||||
public int Precision;
|
||||
public string MemberModifier;
|
||||
|
||||
public CreditNote(AppDbContext ctx, PaymentMember p, CreditNoteData data) :
|
||||
base($"Traubengutschrift {(p.Credit != null ? $"Nr. {p.Credit.Year}/{p.Credit.TgNr}" : p.Member.Name)} – {p.Variant.Name}", p.Member) {
|
||||
@ -19,6 +21,13 @@ namespace Elwig.Documents {
|
||||
Data = data;
|
||||
Payment = p;
|
||||
Credit = p.Credit;
|
||||
var season = p.Variant.Season;
|
||||
var mod = App.Client.IsMatzen ? ctx.Modifiers.Where(m => m.Year == season.Year && m.Name.StartsWith("Treue")).FirstOrDefault() : null;
|
||||
if (mod != null) {
|
||||
MemberModifier = $"{mod.Name} ({mod.ValueStr})";
|
||||
} else {
|
||||
MemberModifier = "Sonstige Zu-/Abschläge";
|
||||
}
|
||||
Aside = Aside.Replace("</table>", "") +
|
||||
$"<thead><tr><th colspan='2'>Gutschrift</th></tr></thead><tbody>" +
|
||||
$"<tr><th>TG-Nr.</th><td>{(p.Credit != null ? $"{p.Credit.Year}/{p.Credit.TgNr}" : "-")}</td></tr>" +
|
||||
@ -27,7 +36,7 @@ namespace Elwig.Documents {
|
||||
$"</tbody></table>";
|
||||
Text = App.Client.TextDeliveryNote;
|
||||
DocumentId = $"Tr.-Gutschr. " + (p.Credit != null ? $"{p.Credit.Year}/{p.Credit.TgNr}" : p.MgNr);
|
||||
CurrencySymbol = p.Variant.Season.Currency.Symbol ?? p.Variant.Season.Currency.Code;
|
||||
Precision = p.Variant.Season.Precision;
|
||||
CurrencySymbol = season.Currency.Symbol ?? season.Currency.Code;
|
||||
Precision = season.Precision;
|
||||
}
|
||||
}}
|
||||
|
Reference in New Issue
Block a user