Documents: Make business documents more compact

This commit is contained in:
2023-09-14 20:44:48 +02:00
parent 470f092482
commit ba691f4d17
10 changed files with 36 additions and 16 deletions

View File

@ -14,5 +14,8 @@
<address>@Model.Address</address>
</div>
<aside>@Raw(Model.Aside)</aside>
@if (Model.ShowDateAndLocation) {
<div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
}
</div>
@RenderBody()

View File

@ -3,6 +3,8 @@ using Elwig.Models;
namespace Elwig.Documents {
public abstract class BusinessDocument : Document {
public bool ShowDateAndLocation = false;
public Member Member;
public bool IncludeSender = false;
public bool UseBillingAddress = false;

View File

@ -7,7 +7,6 @@
var bucketNum = Model.BucketNames.Length;
}
<main>
<div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
<h1>@Model.Title</h1>
<table class="credit">
<colgroup>

View File

@ -16,6 +16,7 @@ namespace Elwig.Documents {
public CreditNote(Credit c, AppDbContext ctx) : base($"Traubengutschrift Nr. {c.TgId} {c.Payment.Variant.Name}", c.Member) {
UseBillingAddress = true;
ShowDateAndLocation = true;
Credit = c;
Aside = Aside.Replace("</table>", "") +
$"<thead><tr><th colspan='2'>Gutschrift</th></tr></thead><tbody>" +

View File

@ -4,7 +4,6 @@
@{ Layout = "BusinessDocument"; }
<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliverynote.css" />
<main>
<div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
<h1>@Model.Title</h1>
@{
bool displayStats = true; // Model.Delivery.Year == Model.CurrentNextSeason
@ -127,7 +126,7 @@
</colgroup>
<thead>
<tr>
<th><b>Gesamtlieferung</b> [kg]</th>
<th><b>Lese @Model.Delivery.Year</b> per @($"{Model.Date:dd.MM.yyyy}") [kg]</th>
<th>Lieferpflicht</th>
<th>Lieferrecht</th>
<th>Unterliefert</th>
@ -147,13 +146,14 @@
$"<td>{sum:N0}</td>";
}
var sortids = Model.Delivery.Parts.Select(p => p.SortId).ToList();
var buckets = Model.MemberBuckets.GroupBy(b => b.Item1[..2]).ToDictionary(g => g.Key, g => g.Count());
}
<tr>
<th>Geschäftsanteile</th>
<th>Gesamtlieferung</th>
@Raw(FormatRow(Model.Member.DeliveryObligation, Model.Member.DeliveryRight, Model.Member.Deliveries.Where(d => d.Year == Model.Delivery.Year).Sum(d => d.Weight)))
</tr>
@foreach (var (id, name, right, obligation, sum) in Model.MemberBuckets.OrderBy(b => b.Item1)) {
if (right > 0 && obligation > 0) {
if (right > 0 || obligation > 0 || (sum > 0 && buckets[id[..2]] > 1)) {
<tr class="@(sortids.Contains(id[..2]) ? "" : "optional")">
<th>@name</th>
@Raw(FormatRow(obligation, right, sum))

View File

@ -11,6 +11,7 @@ namespace Elwig.Documents {
public DeliveryNote(Delivery d, AppDbContext ctx) : base($"Traubenübernahmeschein Nr. {d.LsNr}", d.Member) {
UseBillingAddress = true;
ShowDateAndLocation = true;
Delivery = d;
Aside = Aside.Replace("</table>", "") +
$"<thead><tr><th colspan='2'>Lieferung</th></tr></thead><tbody>" +

View File

@ -9,6 +9,7 @@ namespace Elwig.Documents {
private TempFile? PdfFile = null;
public bool ShowFoldMarks = App.Config.Debug;
public string DataPath;
public int CurrentNextSeason;
public string? DocumentId;
@ -23,8 +24,8 @@ namespace Elwig.Documents {
DataPath = App.DataPath;
CurrentNextSeason = Utils.CurrentNextSeason;
Title = title;
Author = App.Client.NameFull;
Header = $"<h1>{c.Name}</h1>";
Author = c.NameFull;
Header = $"<div class='name'>{c.Name}</div><div class='suffix'>{c.NameSuffix}</div>";
Footer = Utils.GenerateFooter("<br/>", " \u00b7 ")
.Item(c.NameFull).NextLine()
.Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine()

View File

@ -14,6 +14,13 @@
position: relative;
}
.info-wrapper .date {
text-align: right;
position: absolute;
right: 0;
bottom: -1.5em;
}
.address-wrapper {
height: 45mm;
width: 85mm;
@ -80,7 +87,7 @@ main > *:first-child {
margin-top: 0;
}
.main-wrapper h1, .main-wrapper p {
main h1, .main-wrapper p {
font-size: 12pt;
margin: 1em 0;
text-align: justify;
@ -92,12 +99,8 @@ main > *:first-child {
hyphens: manual;
}
.main-wrapper .date {
margin-bottom: 2em;
text-align: right;
}
.main-wrapper h1 {
main h1 {
margin-top: 0;
margin-bottom: 2em;
}

View File

@ -1,4 +1,8 @@
main h1 {
margin-bottom: 1.5em !important;
}
table.delivery {
margin-bottom: 5mm;
}

View File

@ -29,7 +29,7 @@ table th {
header {
height: 45mm;
padding: 5mm;
padding: 10mm 0 0 0;
position: absolute;
top: -25mm;
left: 0;
@ -38,9 +38,15 @@ header {
overflow: hidden;
}
header h1 {
header .name {
font-size: 18pt;
margin-top: 10mm;
font-weight: bold;
}
header .suffix {
font-size: 12pt;
font-weight: bold;
}
.footer-wrapper {