Files
duempelkas/.github/prompts/06-pdf-export.prompt.md
troogs e589cc170a Add GitHub Copilot prompt files
- Step-by-step prompts for solution skeleton, domain model,
  DbContext mappings, application services, UI shell/pages,
  PDF export, and tests/validation
2026-03-31 17:12:35 +02:00

44 lines
1.6 KiB
Markdown

---
description: "Implement QuestPDF-based yearly account statement PDF generation with balance summaries"
agent: "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
1. "Carryover from previous year: X.XX €"
2. "Current year result: X.XX €" (sum of incomes minus sum of expenses)
3. "Final balance: X.XX €" (carryover + current year result)
## Implementation Details
- Use `QuestPDF.Fluent` API with `Document.Create(...)`.
- Set `QuestPDF.Settings.License = LicenseType.Community` in startup.
- Reuse `IBalanceQueryService.GetYearlySummaryAsync` and `IEntryService.GetEntriesAsync` to get the data — do NOT recalculate balances independently.
- Return `byte[]` from `GenerateYearlyStatementAsync`.
- 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.