Add ClientParameters

This commit is contained in:
2023-04-28 11:56:54 +02:00
parent a65345c0d9
commit 351a0b8d57
7 changed files with 74 additions and 13 deletions

View File

@ -16,6 +16,7 @@ namespace Elwig {
public static readonly string ExePath = @"C:\Program Files\Elwig\";
public static readonly Config Config = new(DataPath + "config.ini");
public static IEnumerable<IScale> Scales { get; private set; }
public static ClientParameters Client { get; private set; }
public static bool IsPrintingReady => Documents.Html.IsReady && Documents.Pdf.IsReady;
public static Dispatcher MainDispatcher { get; private set; }
@ -38,6 +39,8 @@ namespace Elwig {
Utils.RunBackground("HTML Initialization", () => Documents.Html.Init(PrintingReadyChanged));
Utils.RunBackground("PDF Initialization", () => Documents.Pdf.Init(PrintingReadyChanged));
Client = new();
var list = new LinkedList<IScale>();
foreach (var s in Config.Scales) {
try {

View File

@ -6,8 +6,10 @@
<div class="info-wrapper">
<div class="address-wrapper">
<div class="sender">
<div>WG Matzen | Schloßstraße 6 | 2243 Matzen</div>
<div>E Österreichische Post AG Eco Brief</div>
@if (Model.IncludeSender) {
<div>@Elwig.App.Client.Sender1</div>
<div>@Elwig.App.Client.Sender2</div>
}
</div>
<address>@Model.Address</address>
</div>

View File

@ -4,9 +4,11 @@ namespace Elwig.Documents {
public abstract class BusinessDocument : Document {
public Member Member;
public bool IncludeSender = false;
public BusinessDocument(string title, Member m) : base(title) {
public BusinessDocument(string title, Member m, bool includeSender = false) : base(title) {
Member = m;
IncludeSender = includeSender;
}
public string Address {
@ -16,7 +18,7 @@ namespace Elwig.Documents {
if (b != null) {
return $"{b.Name}\n{b.Address}\n{plz.Plz} {plz.Dest}";
} else {
return $"{Member.Name}\n{Member.Address}\n{plz.Plz} {plz.Dest}";
return $"{Member.AdministrativeName}\n{Member.Address}\n{plz.Plz} {plz.Dest}";
}
}
}

View File

@ -7,15 +7,15 @@
<table>
<thead>
<tr>
<td rowspan="2">Sorte</td>
<td rowspan="2">Qualitätsstufe</td>
<td colspan="2">Gradation</td>
<td>Gewicht</td>
<th rowspan="2">Sorte</th>
<th rowspan="2">Qualitätsstufe</th>
<th colspan="2">Gradation</th>
<th>Gewicht</th>
</tr>
<tr>
<td>°KMW</td>
<td>°Oe</td>
<td>kg</td>
<th>°KMW</th>
<th>°Oe</th>
<th>kg</th>
</tr>
</thead>
<tbody>

View File

@ -11,8 +11,8 @@ namespace Elwig.Documents {
public Document(string title) {
DataPath = App.DataPath;
Title = title;
Header = "<h1>Winzergenossenschaft Matzen</h1>";
Footer = "Winzergenossenschaft für Matzen und Umgebung reg. Gen.m.b.H.";
Header = $"<h1>{App.Client.Name}</h1>";
Footer = App.Client.NameFull;
Date = DateTime.Today;
}

View File

@ -0,0 +1,47 @@
using Elwig.Models;
namespace Elwig.Helpers {
public class ClientParameters {
public string NameToken;
public string NameShort;
public string NameShortened;
public string Name;
public string NameSuffix;
public string NameFull => $"{Name} {NameSuffix}";
public PostalDest PostalDest {
set {
Plz = value.AtPlz.Plz;
Ort = value.AtPlz.Ort.Name;
}
}
public int Plz { get; private set; }
public string Ort { get; private set; }
public string Address;
public string Sender1 => $"{NameShort} | {Address} | {Plz} {Ort}";
public string Sender2;
public string? Iban;
public string? Bic;
public string? UstId;
public string? LfbisNr;
public string? PhoneNr;
public string? FaxNr;
public string? EmailAddress;
public string? Website;
public ClientParameters() {
NameToken = "WGM";
NameShort = "WG Matzen";
NameShortened = "Winzergenossenschaft f. Matzen u. Umgebung";
Name = "Winzergenossenschaft für Matzen und Umgebung";
NameSuffix = "reg. Gen.m.b.H.";
Plz = 2243;
Ort = "Matzen";
Address = "Schloßstraße 6";
Sender2 = "E Österreichische Post AG Eco Brief";
}
}
}

View File

@ -44,6 +44,13 @@ namespace Elwig.Models {
public string ShortName => GivenName + " " + FamilyName;
public string AdministrativeName =>
FamilyName.ToUpper() + " " +
(Prefix != null ? Prefix + " " : "") +
GivenName +
(MiddleName != null ? " " + MiddleName: "") +
(Suffix != null ? " " + Suffix : "");
[Column("birthday")]
public string? Birthday { get; set; }