about summary refs log tree commit diff stats
path: root/src/Command/ConvertCommand.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Command/ConvertCommand.php')
-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;