BunyMuny/Statement.cs

31 lines
725 B
C#
Raw Normal View History

using System;
2020-09-26 12:45:07 +00:00
using System.Text;
namespace BunyMuny {
public class Statement {
public DateTime Date;
2020-09-26 11:59:06 +00:00
private string _description;
public string Description {
get => string.IsNullOrWhiteSpace(_description) ? OriginalDescription : _description;
set => _description = value;
2020-09-26 11:59:06 +00:00
}
public string OriginalDescription;
public decimal Value;
public string Category;
public override string ToString() {
2020-09-26 12:45:07 +00:00
// e.g.: Debit: $5.00 --> Lynnear Software (Personal) on Apr 2 2020
return String.Format(
2020-09-26 13:09:30 +00:00
"{0} ${1:F2} {2} {3} ({4}) on {5:MMM d yyyy}",
2020-09-26 12:45:07 +00:00
Value < 0 ? "Credit:" : "Debit: ",
Math.Abs(Value),
Value < 0 ? "-->" : "<--",
Description,
Category ?? "Unknown",
Date
);
}
}
}