CreditNote: Add hint regarding calculations

This commit is contained in:
2024-01-07 22:24:06 +01:00
parent 5ae326074f
commit 05b6e8ddd6
2 changed files with 28 additions and 11 deletions

View File

@ -79,14 +79,19 @@
}
</tbody>
</table>
<div class="hint">
Hinweis:<br/>
Die Summe der Lieferungen und die Summe der anfallenden Pönalen werden mit
@Model.Payment?.Variant.Season.Precision Nachkommastellen berechnent,
erst das Ergebnis wird kaufmännisch auf 2 Nachkommastellen gerundet.
</div>
<table class="credit-sum">
@{
string FormatRow(string name, decimal? value, bool add = false, bool bold = false, bool subCat = false) {
return $"<tr class=\"{(bold ? "large bold" : "")}\">"
+ $"<td colspan=\"4\"></td>"
+ $"<td class=\"{(!add ? "sum" : "")} {(subCat ? "small" : "")}\" colspan=\"4\" style=\"overflow: visible;\">{name}:</td>"
+ $"<td class=\"number {(subCat ? "small" : "large")} {(!add ? "sum" : "")}\">{(value < 0 ? "" : (add ? "+" : ""))}</td>"
+ $"<td colspan=\"2\" class=\"number {(subCat ? "small" : "large")} {(!add ? "sum" : "")}\">"
string FormatRow(string name, decimal? value, bool add = false, bool bold = false, bool subCat = false, bool noTopBorder = false) {
return $"<tr class=\"{(!add && !noTopBorder ? "sum" : "")} {(bold ? "large bold" : "")}\">"
+ $"<td class=\"{(subCat ? "small" : "")}\" style=\"overflow: visible;\">{name}:</td>"
+ $"<td class=\"number {(subCat ? "small" : "large")}\">{(value < 0 ? "" : (add ? "+" : ""))}</td>"
+ $"<td class=\"number {(subCat ? "small" : "large")}\">"
+ $"<span class=\"fleft\">{Model.CurrencySymbol}</span>{Math.Abs(value ?? 0):N2}</td>"
+ $"</tr>\n";
}
@ -94,10 +99,10 @@
<tbody style="break-inside: avoid;">
@{ var sum = Model.Data.Rows.Sum(p => p.Amount); }
@if (Model.Payment == null) {
@Raw(FormatRow("Gesamt", sum, bold: true))
@Raw(FormatRow("Gesamt", sum, bold: true, noTopBorder: true))
} else {
if (Model.Payment.NetAmount != Model.Payment.Amount) {
@Raw(FormatRow("Zwischensumme", Model.Payment.NetAmount))
@Raw(FormatRow("Zwischensumme", Model.Payment.NetAmount, noTopBorder: true))
@Raw(FormatRow(Model.MemberModifier, Model.Payment.Amount - Model.Payment.NetAmount, add: true))
}
if (Model.Credit == null) {
@ -120,9 +125,8 @@
@if (Model.MemberUnderDeliveries != null && Model.MemberUnderDeliveries.Count() > 0) {
<tr class="small">
<td colspan="4"></td>
<td colspan="5" style="padding-top: 5mm;">Anfallende Pönalen durch Unterlieferungen:</td>
<td colspan="2"></td>
<td colspan="2" style="padding-top: 5mm;">Anfallende Pönalen durch Unterlieferungen:</td>
<td></td>
</tr>
foreach (var u in Model.MemberUnderDeliveries) {
@Raw(FormatRow($"{u.Name} ({u.Kg:N0} kg)", u.Amount, add: true, subCat: true))

View File

@ -23,6 +23,11 @@ table.credit tr.last td {
padding-bottom: 0;
}
table.credit-sum {
width: 50%;
margin-left: 50%;
}
table.credit-sum tr.sum,
table.credit-sum tr .sum {
font-size: 12pt;
@ -32,3 +37,11 @@ table.credit-sum tr.sum td,
table.credit-sum td.sum {
padding-top: 1mm !important;
}
.hint {
font-style: italic;
font-size: 8pt;
width: 74mm;
float: left;
margin: 2mm 4mm;
}