order statements by date

This commit is contained in:
Lynne Megido 2020-09-26 23:09:30 +10:00
parent e45c36e6e3
commit 95ae8f11b3
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
2 changed files with 6 additions and 2 deletions

View file

@ -4,6 +4,7 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Text.Json; using System.Text.Json;
using System.CommandLine.DragonFruit; using System.CommandLine.DragonFruit;
using System.Linq;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using CsvHelper; using CsvHelper;
@ -54,6 +55,7 @@ namespace BunyMuny {
switch (bank) { switch (bank) {
case Bank.ME: case Bank.ME:
var value = double.Parse(csv.GetField("Debits and credits").TrimStart().Replace("$", "")); var value = double.Parse(csv.GetField("Debits and credits").TrimStart().Replace("$", ""));
// SHOW PET THIS
var ruleValues = MatchAgainstRules(rules, csv.GetField("Description")); var ruleValues = MatchAgainstRules(rules, csv.GetField("Description"));
statements.Add(new Statement() { 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); Console.WriteLine(statement);
} }

View file

@ -17,7 +17,7 @@ namespace BunyMuny {
public override string ToString() { public override string ToString() {
// e.g.: Debit: $5.00 --> Lynnear Software (Personal) on Apr 2 2020 // e.g.: Debit: $5.00 --> Lynnear Software (Personal) on Apr 2 2020
return String.Format( 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: ", Value < 0 ? "Credit:" : "Debit: ",
Math.Abs(Value), Math.Abs(Value),
Value < 0 ? "-->" : "<--", Value < 0 ? "-->" : "<--",