diff options
author | Alan Pearce | 2015-04-07 11:36:26 +0100 |
---|---|---|
committer | Alan Pearce | 2015-04-07 11:36:26 +0100 |
commit | 3fef61d9a4ae38f7f325d3eee3a32753ec06a177 (patch) | |
tree | d6f99363f9bb9cdf81ef4e3858556a49825aaa5d | |
parent | b7f04b53b91cb586324f780ca985cbe4f6137d57 (diff) | |
download | ynab-ledger-3fef61d9a4ae38f7f325d3eee3a32753ec06a177.tar.xz ynab-ledger-3fef61d9a4ae38f7f325d3eee3a32753ec06a177.zip |
Don’t prepend income wth Expenses category
-rw-r--r-- | src/Command/ConvertCommand.php | 12 |
1 files changed, 10 insertions, 2 deletions
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) { | |||
147 | 147 | ||
148 | do { | 148 | do { |
149 | $target = new LedgerPosting; | 149 | $target = new LedgerPosting; |
150 | $target->account = array_merge(['Expenses'], $txn->category); | 150 | if ($txn->category[0] == 'Income') { |
151 | $target->account = $txn->category; | ||
152 | } else { | ||
153 | $target->account = array_merge(['Expenses'], $txn->category); | ||
154 | } | ||
151 | $target->currency = $txn->currency; | 155 | $target->currency = $txn->currency; |
152 | $target->amount = $txn->out - $txn->in; | 156 | $target->amount = $txn->out - $txn->in; |
153 | sscanf($txn->memo, "(Split %d/%d) %[^\r]", $i, $k, $target->note); | 157 | sscanf($txn->memo, "(Split %d/%d) %[^\r]", $i, $k, $target->note); |
@@ -165,7 +169,11 @@ function toLedger (Generator $transactions) { | |||
165 | 169 | ||
166 | } else { | 170 | } else { |
167 | $target = new LedgerPosting; | 171 | $target = new LedgerPosting; |
168 | $target->account = array_merge(['Expenses'], $txn->category); | 172 | if ($txn->category[0] == 'Income') { |
173 | $target->account = $txn->category; | ||
174 | } else { | ||
175 | $target->account = array_merge(['Expenses'], $txn->category); | ||
176 | } | ||
169 | $target->currency = $txn->currency; | 177 | $target->currency = $txn->currency; |
170 | $target->amount = $txn->out - $txn->in; | 178 | $target->amount = $txn->out - $txn->in; |
171 | $lTxn->postings[] = $target; | 179 | $lTxn->postings[] = $target; |