more new code

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8139 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-03-31 04:19:18 +00:00
parent a115451c52
commit 1808028f83

View File

@ -248,16 +248,19 @@ xaccAccountScrubDoubleBalance (Account *acc)
{ {
gnc_commodity *currency = NULL; gnc_commodity *currency = NULL;
SplitList *snode; SplitList *snode;
gnc_numeric zero = gnc_numeric_zero();
gnc_numeric value = zero;
GNCLot *lot = node->data; GNCLot *lot = node->data;
/* We examine only closed lots */ /* We examine only closed lots */
if (FALSE == gnc_lot_is_closed (lot)) continue; if (FALSE == gnc_lot_is_closed (lot)) continue;
/* Check to make sure all splits in the lot have a common currency */
for (snode = lot->splits; snode; snode=snode->next) for (snode = lot->splits; snode; snode=snode->next)
{ {
Split *s = snode->data; Split *s = snode->data;
Transaction *trans = s->parent; Transaction *trans = s->parent;
/* Check to make sure all splits in the lot have a common currency */
if (NULL == currency) if (NULL == currency)
{ {
currency = trans->common_currency; currency = trans->common_currency;
@ -266,11 +269,21 @@ xaccAccountScrubDoubleBalance (Account *acc)
{ {
/* Unhandled error condition. We should do something /* Unhandled error condition. We should do something
* graceful here. Don't know what. FIXME XXX */ * graceful here. Don't know what. FIXME XXX */
PERR ("currencies in lot are not equivalent"); PERR ("currencies in lot are not equivalent\n"
} "\ttrans=%s curr=%s\n", xaccTransGetDescription(trans),
gnc_commodity_get_fullname(trans->common_currency));
} }
/* Now, total up the values */ /* Now, total up the values */
value = gnc_numeric_add (value, xaccSplitGetValue (s),
GNC_DENOM_AUTO, 0);
}
/* Is the value of the lot zero? If not, add a balancing split */
if (FALSE == gnc_numeric_equal (value, zero))
{
}
} }
} }