Modified printable document to align date on the right.

This commit is contained in:
Tobias Erbshäußer
2021-01-01 19:13:22 +01:00
parent 0ba3ea47e2
commit 5c96fced55
+22 -8
View File
@@ -187,19 +187,33 @@ namespace UCalc
cell2.Blocks.Add(new Paragraph(new Run($"{amount.CeilToString()} €")) {Padding = new Thickness(6)}); cell2.Blocks.Add(new Paragraph(new Run($"{amount.CeilToString()} €")) {Padding = new Thickness(6)});
} }
AddText( void AddTextLeftRight(string leftText, string rightText)
$"{Billing.Landlord.Salutation.AsString()} {Billing.Landlord.Name}\n{DateTime.Now.ToString(Constants.DateFormat)}\n\n{Billing.Landlord.Address.Street} {Billing.Landlord.Address.HouseNumber}\n{Billing.Landlord.Address.Postcode} {Billing.Landlord.Address.City}\nTelefon: {Billing.Landlord.Phone}");
if (!string.IsNullOrEmpty(Billing.Landlord.MailAddress))
{ {
AddText($"Email: {Billing.Landlord.MailAddress}"); var row2 = new TableRow();
rowGroup.Rows.Add(row2);
var cell2 = new TableCell();
row2.Cells.Add(cell2);
cell2.Blocks.Add(new Paragraph(new Run(leftText)));
cell2 = new TableCell
{
TextAlignment = TextAlignment.Right
};
row2.Cells.Add(cell2);
cell2.Blocks.Add(new Paragraph(new Run(rightText)));
} }
AddTextLeftRight(
$"{Billing.Landlord.Name}\n{Billing.Landlord.Address.Street} {Billing.Landlord.Address.HouseNumber}\n{Billing.Landlord.Address.Postcode} {Billing.Landlord.Address.City}\nTelefon: {Billing.Landlord.Phone}{(string.IsNullOrEmpty(Billing.Landlord.MailAddress) ? "" : $"\nEmail: {Billing.Landlord.MailAddress}")}",
DateTime.Now.ToString(Constants.DateFormat));
AddLineBreaks(2); AddLineBreaks(2);
AddText( AddText(
$"{tenant.Salutation.AsString()} {tenant.Name}\n{Billing.House.Address.Street} {Billing.House.Address.HouseNumber}\n{Billing.House.Address.Postcode} {Billing.House.Address.City}", $"{tenant.Salutation.AsString()} {tenant.Name}\n{Billing.House.Address.Street} {Billing.House.Address.HouseNumber}\n{Billing.House.Address.Postcode} {Billing.House.Address.City}");
null, true);
AddLineBreaks(4); AddLineBreaks(4);
@@ -240,7 +254,7 @@ namespace UCalc
else else
{ {
AddText( AddText(
$"Der einmalige Betrag von {result.TotalAmount.CeilToString()} € wird in den nächsten Tagen auf Ihr Konto überwiesen."); $"Der einmalige Betrag von {(result.TotalAmount * -1).CeilToString()} € wird in den nächsten Tagen auf Ihr Konto überwiesen.");
} }
AddLineBreaks(1); AddLineBreaks(1);