all repos — archive/ynab-ledger @ 3fef61d9a4ae38f7f325d3eee3a32753ec06a177

Convert exported YNAB data to ledger-cli

Don’t prepend income wth Expenses category

Alan Pearce
commit

3fef61d9a4ae38f7f325d3eee3a32753ec06a177

parent

b7f04b53b91cb586324f780ca985cbe4f6137d57

1 file changed, 10 insertions(+), 2 deletions(-)

jump to
M src/Command/ConvertCommand.phpsrc/Command/ConvertCommand.php
@@ -147,7 +147,11 @@ $source->account = getAccount($txn->account, $txn);
do { $target = new LedgerPosting; - $target->account = array_merge(['Expenses'], $txn->category); + if ($txn->category[0] == 'Income') { + $target->account = $txn->category; + } else { + $target->account = array_merge(['Expenses'], $txn->category); + } $target->currency = $txn->currency; $target->amount = $txn->out - $txn->in; sscanf($txn->memo, "(Split %d/%d) %[^\r]", $i, $k, $target->note);
@@ -165,7 +169,11 @@ $lTxn->postings[] = $source;
} else { $target = new LedgerPosting; - $target->account = array_merge(['Expenses'], $txn->category); + if ($txn->category[0] == 'Income') { + $target->account = $txn->category; + } else { + $target->account = array_merge(['Expenses'], $txn->category); + } $target->currency = $txn->currency; $target->amount = $txn->out - $txn->in; $lTxn->postings[] = $target;