From 367c596ebfbe76706ebe2b4e755500ee82839b2f Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 7 Aug 1998 06:39:07 +0000 Subject: [PATCH] couple of bug fixes git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@941 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/SplitLedger.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SplitLedger.c b/src/SplitLedger.c index 556969e00b..722865449e 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -172,7 +172,7 @@ printf ("save split is %p \n", split); if (MOD_AMNT & changed) { double new_amount; new_amount = (reg->creditCell->amount) - (reg->debitCell->amount); - xaccSplitSetValue (split, new_amount); + xaccSplitSetValue (split, -new_amount); } if (MOD_SHRS & changed) { @@ -190,9 +190,15 @@ printf ("save split is %p \n", split); xaccSplitSetAction (split, reg->actionCell->cell.value); if (MOD_XFRM & changed) { - xaccMoveFarEndByName (split, reg->xfrmCell->cell.value); + Account *old_acc, *new_acc; + + /* do some reparenting */ + old_acc = xaccSplitGetAccount (split); + new_acc = xaccGetPeerAccountFromName (old_acc, reg->xfrmCell->cell.value); + xaccAccountInsertSplit (new_acc, split); } + if (MOD_XTO & changed) { /* hack alert -- implement this */ } @@ -261,7 +267,7 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split) xaccSetComboCellValue (reg->xfrmCell, accname); xaccSetDebCredCellValue (reg->debitCell, - reg->creditCell, xaccSplitGetValue (split)); + reg->creditCell, -xaccSplitGetValue (split)); /* For income and expense acounts, we have to reverse * the meaning of balance, since, in a dual entry @@ -277,7 +283,7 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split) xaccSetAmountCellValue (reg->priceCell, xaccSplitGetSharePrice (split)); xaccSetPriceCellValue (reg->shrsCell, xaccSplitGetShareBalance (split)); - xaccSetAmountCellValue (reg->valueCell, xaccSplitGetValue (split)); + xaccSetAmountCellValue (reg->valueCell, -xaccSplitGetValue (split)); } reg->table->current_cursor->user_data = (void *) split;