AccountingNext/Schaad.Accounting.UI/Components/Pages/Reports/DetailReport.razor
Claudio Schaad 1c5227ab9a PR U-12: report primitives + print CSS
Extract ReportHeader, ReportDivider, ReportSectionHeader, and
ReportFooter under Components/Pages/Reports/ and adopt them across
BalanceReport, BalanceSheetReport, ProfitLossReport, and DetailReport.
Row shapes are unchanged; the primitives just fold the divider hr
rows (30+ occurrences), section headers (8), and header/footer (4
each). ProfitLossReport / DetailReport also drop leftover
`m.Class == 3/4` magic numbers for ClassIds. Print CSS gains
`table.report tr { page-break-inside: avoid; }` so section headers
don't land at the bottom of a page alone. Net -88 lines across the
four report razor files.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-07 08:15:00 +02:00

96 lines
3.3 KiB
Text

@page "/DetailReport"
@if (accounts is null || transactions is null)
{
<Loading/>
return;
}
<ReportHeader Title="@header"/>
<table class="report">
<thead>
<tr>
<th>Konto</th>
<th>Bezeichnung</th>
<th class="right">Betrag</th>
</tr>
<tr>
<th colspan="3"><hr/></th>
</tr>
</thead>
<tbody>
<ReportSectionHeader Title="Einkünfte" Colspan="3"/>
@foreach (var account in accounts.Where(m => m.Class == ClassIds.Income).OrderBy(m => m.Number))
{
@if (account.Balance == 0) { continue; }
<tr>
<td class="header">@account.Number</td>
<td class="header">@account.Name</td>
<td class="header right">@Math.Abs(account.Balance).ToFormattedString()</td>
</tr>
@foreach (var trx in transactions.Where(t => t.TargetAccountId == account.Id || t.OriginAccountId == account.Id).OrderBy(t => t.ValueDate))
{
<tr>
<td>@trx.ValueDate.ToString("dd.MM.yyyy")</td>
<td>@trx.Text</td>
<td class="right">
@if (trx.OriginAccountId == account.Id)
{
@trx.Value.ToFormattedString();
}
else
{
<span>-</span>
@trx.Value.ToFormattedString();
}
</td>
</tr>
}
<ReportDivider Colspan="3"/>
}
<tr>
<td colspan="2" class="total right">Total Einkünfte</td>
<td class="right total">@profit.ToFormattedString()</td>
</tr>
<ReportDivider Colspan="3"/>
<ReportSectionHeader Title="Ausgaben" Colspan="3"/>
@foreach (var account in accounts.Where(m => m.Class == ClassIds.Expenses).OrderBy(m => m.Number))
{
@if (account.Balance == 0) { continue; }
<tr>
<td class="header">@account.Number</td>
<td class="header">@account.Name</td>
<td class="header right">@account.Balance.ToFormattedString()</td>
</tr>
@foreach (var trx in transactions.Where(t => t.TargetAccountId == account.Id || t.OriginAccountId == account.Id).OrderBy(t => t.ValueDate))
{
<tr>
<td>@trx.ValueDate.ToString("dd.MM.yyyy")</td>
<td>@trx.Text</td>
<td class="right">
@if (trx.TargetAccountId == account.Id)
{
@trx.Value.ToFormattedString();
}
else
{
<span>-</span>
@trx.Value.ToFormattedString();
}
</td>
</tr>
}
<ReportDivider Colspan="3"/>
}
<tr>
<td colspan="2" class="total right">Total Ausgaben</td>
<td class="right total">@loss.ToFormattedString()</td>
</tr>
<ReportFooter Footer="@footer"/>
</tbody>
</table>