minor updates

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1155 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1998-09-13 06:32:02 +00:00
parent a5902d581f
commit 2020f2ab82
3 changed files with 30 additions and 1 deletions

View File

@ -799,4 +799,11 @@ xaccAccountGetSplitList (Account *acc)
return (acc->splits);
}
int
xaccAccountGetNumSplits (Account *acc)
{
if (!acc) return 0;
return (acc->numSplits);
}
/*************************** END OF FILE **************************** */

View File

@ -114,6 +114,7 @@ double xaccAccountGetClearedBalance (Account *);
double xaccAccountGetReconciledBalance (Account *);
Split * xaccAccountGetSplit (Account *acc, int i);
Split ** xaccAccountGetSplitList (Account *acc);
int xaccAccountGetNumSplits (Account *acc);
/** GLOBALS *********************************************************/

View File

@ -4,6 +4,8 @@
*
* DESCRIPTION:
* Provide a simple query engine interface.
* Note that the query engine is officially a part of the transaction engine,
* and thus has direct access to internal structures.
*
* HISTORY:
* created by Linas Vepstas Sept 1998
@ -142,12 +144,21 @@ xaccQuerySetMaxSplits (Query *q, int max)
/* ================================================== */
static void
SortSplits (Query *q)
{
}
/* ================================================== */
Split **
xaccQueryGetSplits (Query *q)
{
int i=0, j=0;
int nlist, nstart, nret;
int nlist, nstart, nret, nsplits;
Split *s, **slist;
Account *acc;
if (!q) return NULL;
@ -158,6 +169,16 @@ xaccQueryGetSplits (Query *q)
if (q->split_list) _free (q->split_list);
q->split_list = NULL;
/* count the number of splits in each account */
nsplits = 0;
if (q->acc_list) {
i=0; acc = q->acc_list[0];
while (acc) {
nsplits += xaccAccountGetNumSplits (acc);
i++; acc = q->acc_list[i];
}
}
/* hack alert */
slist = xaccAccountGetSplitList (q->acc_list[0]);
if (!slist) return NULL;