about summary refs log tree commit diff stats
path: root/src/Command
diff options
context:
space:
mode:
authorAlan Pearce2015-04-07 11:36:26 +0100
committerAlan Pearce2015-04-07 11:36:26 +0100
commit3fef61d9a4ae38f7f325d3eee3a32753ec06a177 (patch)
treed6f99363f9bb9cdf81ef4e3858556a49825aaa5d /src/Command
parentb7f04b53b91cb586324f780ca985cbe4f6137d57 (diff)
downloadynab-ledger-3fef61d9a4ae38f7f325d3eee3a32753ec06a177.tar.lz
ynab-ledger-3fef61d9a4ae38f7f325d3eee3a32753ec06a177.tar.zst
ynab-ledger-3fef61d9a4ae38f7f325d3eee3a32753ec06a177.zip
Don’t prepend income wth Expenses category
Diffstat (limited to 'src/Command')
-rw-r--r--src/Command/ConvertCommand.php12
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) {
 
                 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;