Add club settings and use club name in PDF exports
This commit is contained in:
@@ -15,13 +15,15 @@ public class PdfStatementService : IPdfStatementService
|
||||
private readonly FinanceDbContext _db;
|
||||
private readonly IEntryService _entryService;
|
||||
private readonly IBalanceQueryService _balanceQueryService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private static readonly CultureInfo DeLocale = new("de-DE");
|
||||
|
||||
public PdfStatementService(FinanceDbContext db, IEntryService entryService, IBalanceQueryService balanceQueryService)
|
||||
public PdfStatementService(FinanceDbContext db, IEntryService entryService, IBalanceQueryService balanceQueryService, ISettingsService settingsService)
|
||||
{
|
||||
_db = db;
|
||||
_entryService = entryService;
|
||||
_balanceQueryService = balanceQueryService;
|
||||
_settingsService = settingsService;
|
||||
}
|
||||
|
||||
public async Task<byte[]> GenerateStatementAsync(int accountId, bool currentYearOnly)
|
||||
@@ -31,6 +33,7 @@ public class PdfStatementService : IPdfStatementService
|
||||
|
||||
var entries = await _entryService.GetEntriesAsync(accountId, currentYearOnly);
|
||||
var balance = await _balanceQueryService.GetAccountBalanceAsync(accountId);
|
||||
var clubName = await _settingsService.GetClubNameAsync() ?? "Mein Verein";
|
||||
|
||||
var title = currentYearOnly
|
||||
? $"{account.Name} – Auszug {DateTime.Now.Year}"
|
||||
@@ -47,7 +50,7 @@ public class PdfStatementService : IPdfStatementService
|
||||
|
||||
page.Header().Column(col =>
|
||||
{
|
||||
col.Item().Text(account.Name).Bold().FontSize(20);
|
||||
col.Item().Text(clubName).Bold().FontSize(20);
|
||||
col.Item().Text(title).FontSize(14).FontColor(Colors.Grey.Darken1);
|
||||
col.Item().PaddingTop(5).Text($"Erstellt am: {DateTime.Now:dd.MM.yyyy}").FontSize(8).FontColor(Colors.Grey.Medium);
|
||||
col.Item().PaddingTop(10).LineHorizontal(1).LineColor(Colors.Grey.Lighten2);
|
||||
|
||||
Reference in New Issue
Block a user