about summary refs log tree commit diff stats
path: root/src/Command
diff options
context:
space:
mode:
authorAlan Pearce2015-04-06 16:29:53 +0100
committerAlan Pearce2015-04-06 16:29:53 +0100
commitb7f04b53b91cb586324f780ca985cbe4f6137d57 (patch)
tree7040e57d77bbeaba2b624e6c978d5b775dc9d3a6 /src/Command
parentb0268d45630f86546a7e6b97b86ebba17491ed26 (diff)
downloadynab-ledger-b7f04b53b91cb586324f780ca985cbe4f6137d57.tar.lz
ynab-ledger-b7f04b53b91cb586324f780ca985cbe4f6137d57.tar.zst
ynab-ledger-b7f04b53b91cb586324f780ca985cbe4f6137d57.zip
Invert the sign of necessary transaction amounts
Diffstat (limited to 'src/Command')
-rw-r--r--src/Command/ConvertCommand.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Command/ConvertCommand.php b/src/Command/ConvertCommand.php
index fe9868a..99113ac 100644
--- a/src/Command/ConvertCommand.php
+++ b/src/Command/ConvertCommand.php
@@ -129,7 +129,7 @@ function toLedger (Generator $transactions) {
                 $target = new LedgerPosting;
                 $target->account = getAccount(explode(' : ', $txn->payee)[1], $txn);
                 $target->currency = $txn->currency;
-                $target->amount = $txn->in - $txn->out;
+                $target->amount = $txn->out - $txn->in;
                 $lTxn->postings[] = $target;
 
                 $source = new LedgerPosting;
@@ -149,7 +149,7 @@ function toLedger (Generator $transactions) {
                     $target = new LedgerPosting;
                     $target->account = array_merge(['Expenses'], $txn->category);
                     $target->currency = $txn->currency;
-                    $target->amount = $txn->in - $txn->out;
+                    $target->amount = $txn->out - $txn->in;
                     sscanf($txn->memo, "(Split %d/%d) %[^\r]", $i, $k, $target->note);
                     $lTxn->postings[] = $target;
 
@@ -167,7 +167,7 @@ function toLedger (Generator $transactions) {
                 $target = new LedgerPosting;
                 $target->account = array_merge(['Expenses'], $txn->category);
                 $target->currency = $txn->currency;
-                $target->amount = $txn->in - $txn->out;
+                $target->amount = $txn->out - $txn->in;
                 $lTxn->postings[] = $target;
 
                 $source = new LedgerPosting;