Skip to content

Commit a4280bd

Browse files
committed
Move summary to the top of the report.
1 parent fc29307 commit a4280bd

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Source/WPF/MyMoney/Reports/FutureBillsReport.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
using System.Diagnostics;
55
using System.Linq;
66
using System.Threading.Tasks;
7+
using System.Windows;
8+
using System.Windows.Documents;
9+
using System.Windows.Media.Media3D;
710
using Walkabout.Data;
811
using Walkabout.Interfaces.Reports;
912
using Walkabout.Utilities;
13+
using static System.Net.Mime.MediaTypeNames;
1014

1115
namespace Walkabout.Reports
1216
{
@@ -281,6 +285,14 @@ public override Task Generate(IReportWriter writer)
281285
{
282286
writer.WriteHeading("Future Bills Report");
283287

288+
Paragraph summary = null;
289+
290+
if (writer is FlowDocumentReportWriter flow)
291+
{
292+
writer.WriteParagraph("");
293+
summary = flow.CurrentParagraph;
294+
}
295+
284296
Transactions transactions = this.myMoney.Transactions;
285297

286298
DateTime today = DateTime.Now;
@@ -336,7 +348,8 @@ public override Task Generate(IReportWriter writer)
336348

337349
if (recurring.Count == 0)
338350
{
339-
writer.WriteParagraph("No recuring payments found");
351+
Run run = (Run)summary.Inlines.FirstInline;
352+
run.Text = "No recuring payments found";
340353
}
341354
else
342355
{
@@ -385,7 +398,9 @@ public override Task Generate(IReportWriter writer)
385398
writer.EndTable();
386399
}
387400

388-
writer.WriteParagraph(string.Format("Total over next 12 months is {0:C}", -total));
401+
// Add summary.
402+
Run run = (Run)summary.Inlines.FirstInline;
403+
run.Text = string.Format("Total over next 12 months is {0:C}", -total);
389404

390405
this.WriteTrailer(writer, DateTime.Today);
391406
}

0 commit comments

Comments
 (0)