From 3fef61d9a4ae38f7f325d3eee3a32753ec06a177 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 7 Apr 2015 11:36:26 +0100 Subject: Don’t prepend income wth Expenses category --- src/Command/ConvertCommand.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Command/ConvertCommand.php') diff --git a/src/Command/ConvertCommand.php b/src/Command/ConvertCommand.php index 99113ac..c1a17f2 100644 --- a/src/Command/ConvertCommand.php +++ b/src/Command/ConvertCommand.php @@ -147,7 +147,11 @@ function toLedger (Generator $transactions) { 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 @@ function toLedger (Generator $transactions) { } 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; -- cgit 1.4.1