Format transaction amounts on output
This might want to use the same YNAB CSV format as `convert`.
This commit is contained in:
+1
-1
@@ -171,7 +171,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
};
|
||||
println!("Transactions{} in the last 30 days:", accountstr);
|
||||
for t in transactions {
|
||||
println!("{},{},{}", t.date, t.payee, t.amount);
|
||||
println!("{},{},{}", t.date, t.payee, t.format_amount());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ impl Transaction {
|
||||
})
|
||||
}
|
||||
|
||||
fn format_amount(&self) -> String {
|
||||
pub fn format_amount(&self) -> String {
|
||||
let whole = self.amount / 10 / 100;
|
||||
let frac = if self.amount < 0 { -1 } else { 1 } * (self.amount / 10) % 100;
|
||||
format!("{}.{:02}", whole, frac)
|
||||
|
||||
Reference in New Issue
Block a user