[#48] Billing: Add custom modifiers for members
All checks were successful
Test / Run tests (push) Successful in 2m21s

This commit is contained in:
2024-06-27 13:40:52 +02:00
parent 5c76b8ec52
commit 5037818997
12 changed files with 234 additions and 28 deletions

View File

@ -20,6 +20,7 @@ namespace Elwig.Documents {
public decimal MemberTotalUnderDelivery;
public int MemberAutoBusinessShares;
public decimal MemberAutoBusinessSharesAmount;
public PaymentCustom? CustomPayment;
public CreditNote(
AppDbContext ctx,
@ -28,6 +29,7 @@ namespace Elwig.Documents {
bool considerContractPenalties,
bool considerTotalPenalty,
bool considerAutoBusinessShares,
bool considerCustomModifiers,
Dictionary<string, UnderDelivery>? underDeliveries = null
) :
base($"{Name} {(p.Credit != null ? $"Nr. {p.Credit.Year}/{p.Credit.TgNr:000}" : p.Member.Name)} {p.Variant.Name}", p.Member) {
@ -85,5 +87,8 @@ namespace Elwig.Documents {
.Where(u => u.Item3 != 0)
.ToList();
}
if (considerCustomModifiers) {
CustomPayment = ctx.CustomPayments.Find(p.Year, p.MgNr);
}
}
}}

View File

@ -157,13 +157,17 @@
@Raw(FormatRow($"Autom. Nachz. von GA ({Model.MemberAutoBusinessShares})", Model.MemberAutoBusinessSharesAmount, add: true));
penalty += Model.MemberAutoBusinessSharesAmount;
}
@if (Model.CustomPayment != null) {
@Raw(FormatRow(Model.CustomPayment.Comment ?? (Model.CustomPayment.Amount < 0 ? "Weitere Abzüge" : "Weitere Zuschläge"), Model.CustomPayment.Amount, add: true));
penalty += Model.CustomPayment.Amount;
}
@if (Model.Credit == null) {
@Raw(FormatRow("Auszahlungsbetrag", (Model.Payment?.Amount + penalty) ?? (sum + penalty), bold: true))
} else {
var diff = Model.Credit.Modifiers - penalty;
if (diff != 0) {
@Raw(FormatRow(diff < 0 ? "Weitere Abzüge" : "Weitere Zuschläge", diff, add: true))
@Raw(FormatRow(diff < 0 ? "Sonstige Abzüge" : "Sonstige Zuschläge", diff, add: true))
}
if (Model.Credit.PrevModifiers != null && Model.Credit.PrevModifiers != 0) {
@Raw(FormatRow("Bereits berücksichtigte Abzüge", -Model.Credit.PrevModifiers, add: true))