Make document footer more dynamic
This commit is contained in:
@ -14,11 +14,12 @@ namespace Elwig.Documents {
|
|||||||
CurrentNextSeason = Utils.CurrentNextSeason;
|
CurrentNextSeason = Utils.CurrentNextSeason;
|
||||||
Title = title;
|
Title = title;
|
||||||
Header = $"<h1>{c.Name}</h1>";
|
Header = $"<h1>{c.Name}</h1>";
|
||||||
Footer = $"{c.NameFull}<br/>" +
|
Footer = Utils.GenerateFooter("<br/>", " \u00b7 ")
|
||||||
$"{c.Address} \u00b7 {c.Plz} {c.Ort} \u00b7 Österreich \u00b7 " +
|
.Item(c.NameFull).NextLine()
|
||||||
$"Tel.: {c.PhoneNr} \u00b7 Fax: {c.FaxNr}<br/>{c.EmailAddress} \u00b7 {c.Website} \u00b7 " +
|
.Item(c.Address).Item($"{c.Plz} {c.Ort}").Item("Österreich").Item("Tel.", c.PhoneNr).Item("Fax", c.FaxNr).NextLine()
|
||||||
$"Betriebs-Nr.: {c.LfbisNr} \u00b7 UID: {c.UstId}<br/>" +
|
.Item(c.EmailAddress).Item(c.Website).Item("Betriebs-Nr.", c.LfbisNr).Item("UID", c.UstId).NextLine()
|
||||||
$"BIC: {c.Bic} \u00b7 IBAN: {c.Iban}";
|
.Item("BIC", c.Bic).Item("IBAN", c.Iban)
|
||||||
|
.ToString();
|
||||||
Date = DateTime.Today;
|
Date = DateTime.Today;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,5 +195,44 @@ namespace Elwig.Helpers {
|
|||||||
var d = new ManualWeighingDialog();
|
var d = new ManualWeighingDialog();
|
||||||
return d.ShowDialog() == true ? (d.Weight, d.Reason) : null;
|
return d.ShowDialog() == true ? (d.Weight, d.Reason) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Footer GenerateFooter(string lineBreak, string seperator) {
|
||||||
|
return new Footer(lineBreak, seperator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Footer {
|
||||||
|
private string Text = "";
|
||||||
|
private readonly string LineBreak;
|
||||||
|
private readonly string Seperator;
|
||||||
|
private bool FirstLine = true;
|
||||||
|
private bool FirstItemInLine = true;
|
||||||
|
|
||||||
|
public Footer(string lineBreak, string seperator) {
|
||||||
|
LineBreak = lineBreak;
|
||||||
|
Seperator = seperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Footer Item(string? text) {
|
||||||
|
if (text == null) return this;
|
||||||
|
Text += FirstItemInLine ? (FirstLine ? "" : LineBreak) : Seperator;
|
||||||
|
Text += text;
|
||||||
|
FirstLine = false;
|
||||||
|
FirstItemInLine = false;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Footer Item(string name, string? text) {
|
||||||
|
return text == null ? this : Item($"{name}: {text}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Footer NextLine() {
|
||||||
|
FirstItemInLine = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user