all repos — archive/ynab-ledger @ b7f04b53b91cb586324f780ca985cbe4f6137d57

Convert exported YNAB data to ledger-cli

Invert the sign of necessary transaction amounts

Alan Pearce
commit

b7f04b53b91cb586324f780ca985cbe4f6137d57

parent

b0268d45630f86546a7e6b97b86ebba17491ed26

1 file changed, 3 insertions(+), 3 deletions(-)

jump to
M src/Command/ConvertCommand.phpsrc/Command/ConvertCommand.php
@@ -129,7 +129,7 @@ }
$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 @@ do {
$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 @@ } else {
$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;