- Step-by-step prompts for solution skeleton, domain model, DbContext mappings, application services, UI shell/pages, PDF export, and tests/validation
1.6 KiB
1.6 KiB
description, agent
| description | agent |
|---|---|
| Implement QuestPDF-based yearly account statement PDF generation with balance summaries | agent |
Step 6: PDF Export
Implement PdfStatementService in src/Duempelkas.Infrastructure/Services/.
PDF Document Structure
Generate one PDF per account/year with the following sections:
Header
- Account name (bold, large)
- Year (e.g., "Statement 2026")
- Generation date
Opening Balance Section
- "Carryover from previous year: X.XX €"
Ledger Table
- Columns: Date, Title, Type, Amount
- Rows sorted chronologically (oldest → newest)
- Type column shows "Income", "Expense", or "Transfer" (for linked entries)
- Transfer rows should include a note like "→ TargetAccountName" or "← SourceAccountName"
- Amount formatted as "1.234,56 €" (German locale)
Summary Footer
- "Carryover from previous year: X.XX €"
- "Current year result: X.XX €" (sum of incomes minus sum of expenses)
- "Final balance: X.XX €" (carryover + current year result)
Implementation Details
- Use
QuestPDF.FluentAPI withDocument.Create(...). - Set
QuestPDF.Settings.License = LicenseType.Communityin startup. - Reuse
IBalanceQueryService.GetYearlySummaryAsyncandIEntryService.GetEntriesAsyncto get the data — do NOT recalculate balances independently. - Return
byte[]fromGenerateYearlyStatementAsync. - Use A4 page size, reasonable margins, and professional typography.
Conventions
- Keep the PDF layout in a single service method or split into private helper methods.
- Use
CultureInfo("de-DE")for number/currency formatting.