adjust fixes

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@285 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1997-12-04 21:56:42 +00:00
parent ab2a5023f4
commit 931512eff1

View File

@ -292,7 +292,7 @@ adjBOkCB( Widget mw, XtPointer cd, XtPointer cb )
acc->parent->saved = False;
/* allocate mem for the new transaction */
trans = (Transaction *)_malloc(sizeof(Transaction));
trans = mallocTransaction();
/* Create the "trans" transaction */
str = XmTextGetString(adjBData->date);
@ -304,20 +304,19 @@ adjBOkCB( Widget mw, XtPointer cd, XtPointer cb )
themount = val;
/* fill out the rest of the fields */
trans->num = XtNewString("");
trans->memo = XtNewString("");
XtFree (trans->description);
trans->description = XtNewString("Adjust Balance");
trans->catagory = 0;
trans->reconciled = NREC;
pos = insertTransaction( acc, trans );
/* figure out what the amount for this transaction... figure out
* the current balance, and take the diff from amount */
dcurrAmount = 0.0;
for( i=0; i<pos; i++ )
{
tempTrans = getTransaction(acc,i);
dcurrAmount += xaccGetAmount (acc, trans);
dcurrAmount += xaccGetAmount (acc, tempTrans);
}
xaccSetAmount (acc, trans, themount - dcurrAmount);