From cbad81edebca6bda46edba4fd100db330dddd24c Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 1 Feb 1998 04:36:05 +0000 Subject: [PATCH] handle transfer types git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@475 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/Ledger.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Ledger.c b/src/Ledger.c index 3781cd7695..97be1c30e3 100644 --- a/src/Ledger.c +++ b/src/Ledger.c @@ -63,10 +63,29 @@ xaccSaveRegEntry (BasicRegister *reg) /* ======================================================== */ +static Account * +GetPeerAcc (Split *split) +{ + Account *acc; + Transaction *trans; + trans = (Transaction *) (split->parent); + + /* hack alert -- this is incorrect for splits in general */ + if (split != &(trans->credit_split)) { + acc = (Account *) trans->credit_split.acc; + } else { + acc = (Account *) trans->debit_splits[0]->acc; + } + return acc; +} + +/* ======================================================== */ + void xaccLoadRegEntry (BasicRegister *reg, Split *split) { Transaction *trans; + Account *acc; char buff[2]; if (!split) return; @@ -85,6 +104,10 @@ xaccLoadRegEntry (BasicRegister *reg, Split *split) buff[1] = 0x0; xaccSetBasicCellValue (reg->recnCell, buff); + /* the transfer account */ + acc = GetPeerAcc (split); + xaccSetBasicCellValue (&(reg->xfrmCell->cell), acc->accountName); + xaccSetDebCredCellValue (reg->debitCell, reg->creditCell, split->damount);