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;
|
||||
}
|
||||
}}
|
||||
|
@ -80,17 +80,69 @@
|
||||
}
|
||||
}
|
||||
@if (Model.Payment == null) {
|
||||
<tr class="sum">
|
||||
<td colspan="7"></td>
|
||||
<td colspan="2">Gesamt:</td>
|
||||
<td colspan="2" class="number">@($"{Model.Data.Rows.Sum(p => p.Amount):N2}")</td>
|
||||
</tr>
|
||||
<tr class="sum">
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4">Gesamt:</td>
|
||||
<td></td>
|
||||
<td colspan="2" class="number">
|
||||
<span class="fleft">@Model.CurrencySymbol</span>
|
||||
@($"{Model.Data.Rows.Sum(p => p.Amount):N2}")
|
||||
</td>
|
||||
</tr>
|
||||
} else {
|
||||
<tr class="sum">
|
||||
<td colspan="7"></td>
|
||||
<td colspan="2">Gesamt:</td>
|
||||
<td colspan="2" class="number">@($"{Model.Payment.NetAmount:N2}")</td>
|
||||
</tr>
|
||||
var totalLine = false;
|
||||
if (Model.Payment.NetAmount != Model.Payment.Amount) {
|
||||
<tr class="sum">
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4">Zwischensumme:</td>
|
||||
<td></td>
|
||||
<td colspan="2" class="number">
|
||||
<span class="fleft">@Model.CurrencySymbol</span>
|
||||
@($"{Model.Payment.NetAmount:N2}")
|
||||
</td>
|
||||
</tr>
|
||||
totalLine = true;
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4">@Model.MemberModifier:</td>
|
||||
<td class="number large">@(Model.Payment.NetAmount > Model.Payment.Amount ? "–" : "+")</td>
|
||||
<td colspan="2" class="number large">
|
||||
<span class="fleft">@Model.CurrencySymbol</span>
|
||||
@($"{Math.Abs(Model.Payment.Amount - Model.Payment.NetAmount):N2}")
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
if (Model.Credit == null) {
|
||||
<tr class="bold large @(!totalLine ? "sum" : "")">
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4" class="@(totalLine ? "sum" : "")">Gesamtbetrag:</td>
|
||||
<td class="@(totalLine ? "sum" : "")"></td>
|
||||
<td colspan="2" class="number @(totalLine ? "sum" : "")">
|
||||
<span class="fleft">@Model.CurrencySymbol</span>
|
||||
@($"{Model.Payment.Amount:N2}")
|
||||
</td>
|
||||
</tr>
|
||||
totalLine = true;
|
||||
} else {
|
||||
<tr class="bold large @(!totalLine ? "sum" : "")">
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4" class="@(totalLine ? "sum" : "")">Nettobetrag:</td>
|
||||
<td class="@(totalLine ? "sum" : "")"></td>
|
||||
<td colspan="2" class="number @(totalLine ? "sum" : "")">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
totalLine = true;
|
||||
|
||||
<tr class="large bold">
|
||||
<td colspan="4"></td>
|
||||
<td colspan="4">Bruttobetrag:</td>
|
||||
<td></td>
|
||||
<td colspan="2" class="number">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -17,10 +17,11 @@ table.credit tr.last td {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
table.credit tr.sum {
|
||||
table.credit .sum {
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
table.credit tr.sum td {
|
||||
padding-top: 1mm;
|
||||
table.credit tr.sum td,
|
||||
table.credit td.sum {
|
||||
padding-top: 1mm !important;
|
||||
}
|
||||
|
@ -122,11 +122,14 @@ main table tr.bold td {
|
||||
}
|
||||
|
||||
main table tr.sum,
|
||||
main table td.sum,
|
||||
main table tr.new,
|
||||
main table tr.border {
|
||||
border-top: 0.5pt solid black;
|
||||
}
|
||||
main table tr.sum {
|
||||
|
||||
main table tr.sum,
|
||||
main table td.sum {
|
||||
break-before: avoid;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user