AccountingNext/Schaad.Accounting.UI/Components/Pages/Reports/ProfitLossReport.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

79 lines
2.5 KiB
Text

@page "/ProfitLossReport"
@if (accounts is null)
{
<Loading/>
return;
}
<ReportHeader Title="@header"/>
<table class="report">
<thead>
<tr>
<th>Konto</th>
<th>Bezeichnung</th>
<th class="right">Aufwand</th>
<th class="right">Ertrag</th>
</tr>
<tr>
<th colspan="4"><hr/></th>
</tr>
</thead>
<tbody>
<ReportSectionHeader Title="Einkünfte" Colspan="4"/>
@foreach (var account in accounts.Where(m => m.Class == ClassIds.Income).OrderBy(m => m.Number))
{
@if (account.Balance == 0) { continue; }
<tr>
<td>@account.Number</td>
<td>@account.Name</td>
<td></td>
<td class="right">@Math.Abs(account.Balance).ToFormattedString()</td>
</tr>
}
<ReportDivider Colspan="4"/>
<tr>
<td colspan="2" class="total">Total Einkünfte</td>
<td></td>
<td class="right total">@profit.ToFormattedString()</td>
</tr>
<ReportDivider Colspan="4"/>
<ReportSectionHeader Title="Ausgaben" Colspan="4"/>
@foreach (var account in accounts.Where(m => m.Class == ClassIds.Expenses).OrderBy(m => m.Number))
{
@if (account.Balance == 0) { continue; }
<tr>
<td>@account.Number</td>
<td>@account.Name</td>
<td class="right">@Math.Abs(account.Balance).ToFormattedString()</td>
<td></td>
</tr>
}
<ReportDivider Colspan="4"/>
<tr>
<td colspan="2" class="total">Total Ausgaben</td>
<td class="right total">@loss.ToFormattedString()</td>
<td></td>
</tr>
<ReportDivider Colspan="4"/>
<tr>
<td colspan="2" class="total"></td>
<td class="right total">@loss.ToFormattedString()</td>
<td class="right total">@profit.ToFormattedString()</td>
</tr>
<tr>
<td colspan="2" class="total">Gewinn/Verlust</td>
<td class="right total sum">@win.ToFormattedString()</td>
<td class="right total sum"></td>
</tr>
<tr>
<td colspan="2" class="total">Total</td>
<td class="right total sum">@profit.ToFormattedString()</td>
<td class="right total sum">@profit.ToFormattedString()</td>
</tr>
<ReportFooter Footer="@footer" Colspan="4"/>
</tbody>
</table>