blob: 0bba75a4509badb1246ec5eef3ebcb4e1949f3b2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
mod ynab;
fn main() {
let key = std::env::args().nth(1).unwrap();
let client = ynab::Client::new(&key);
let budget = client.default_budget();
let reimbursables = budget.reimbursables();
println!("using budget {} ({})", budget.name(), budget.id());
let reconciled_amount: i64 = reimbursables
.iter()
.filter(|t| t.reimbursed)
.map(|t| t.amount)
.sum();
if reconciled_amount != 0 {
eprintln!(
"reconciled reimbursables don't sum to $0.00: ${}",
ynab::format_amount(reconciled_amount)
);
std::process::exit(1);
}
println!("reconciled reimbursables correctly sum to $0.00");
println!("ready for reconciliation:");
for t in reimbursables
.iter()
.filter(|t| !t.reimbursed && t.amount > 0)
{
println!(
"{} | {} | {}",
t.date,
t.payee,
ynab::format_amount(t.amount)
)
}
println!("match against reconcilable:");
for t in reimbursables
.iter()
.filter(|t| !t.reimbursed && t.amount <= 0)
{
println!(
"{} | {} | {}",
t.date,
t.payee,
ynab::format_amount(t.amount)
)
}
}
|