From 95ae8f11b3372bbc603c387184a1568e96bf5f5d Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Sat, 26 Sep 2020 23:09:30 +1000 Subject: [PATCH] order statements by date --- Program.cs | 6 +++++- Statement.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index 0787d93..4a0d575 100644 --- a/Program.cs +++ b/Program.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.IO; using System.Text.Json; using System.CommandLine.DragonFruit; +using System.Linq; using System.Text.Json.Serialization; using CsvHelper; @@ -54,6 +55,7 @@ namespace BunyMuny { switch (bank) { case Bank.ME: var value = double.Parse(csv.GetField("Debits and credits").TrimStart().Replace("$", "")); + // SHOW PET THIS var ruleValues = MatchAgainstRules(rules, csv.GetField("Description")); statements.Add(new Statement() { @@ -79,7 +81,9 @@ namespace BunyMuny { } } - foreach (var statement in statements) { + foreach (var statement in statements. + Where(s => s.Category != null). + OrderBy(s => s.Date)) { Console.WriteLine(statement); } diff --git a/Statement.cs b/Statement.cs index 587c909..a741658 100644 --- a/Statement.cs +++ b/Statement.cs @@ -17,7 +17,7 @@ namespace BunyMuny { public override string ToString() { // e.g.: Debit: $5.00 --> Lynnear Software (Personal) on Apr 2 2020 return String.Format( - "{0} ${1:0.##} {2} {3} ({4}) on {5:MMM d yyyy}", + "{0} ${1:F2} {2} {3} ({4}) on {5:MMM d yyyy}", Value < 0 ? "Credit:" : "Debit: ", Math.Abs(Value), Value < 0 ? "-->" : "<--",