mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-05-17 Dave Peticolas <dave@krondo.com>
* src/doc/design/engine.texinfo: update docs * src/engine/Account.c (xaccAccountRecomputeBalance): include frozen splits in reconciled balance. Fix variable names. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4233 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
664d9be4cd
commit
5771ed73ef
@ -1,5 +1,10 @@
|
||||
2001-05-17 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/doc/design/engine.texinfo: update docs
|
||||
|
||||
* src/engine/Account.c (xaccAccountRecomputeBalance): include
|
||||
frozen splits in reconciled balance. Fix variable names.
|
||||
|
||||
* accounts/C/*: tweak detailed descriptions
|
||||
|
||||
* doc/sgml/C/xacc-reports.sgml: fix warnings
|
||||
|
@ -1938,6 +1938,91 @@ security field, that field will be returned. Otherwise, the currency will
|
||||
be returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {AccountGroup *} xaccAccountGetChildren (Account * @var{account})
|
||||
Return the child group of @var{account}. The child group may be @code{NULL},
|
||||
indicating @var{account} has no children.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {AccountGroup *} xaccAccountGetParent (Account * @var{account})
|
||||
Return the parent Group of @var{account}. The parent may be @code{NULL},
|
||||
indicating @var{account} is a top-level Account. However, even if the
|
||||
parent is not @code{NULL}, the account may still be top-level if the
|
||||
parent Group has no parent Account.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {Account *} xaccAccountGetParentAccount (Account * @var{account})
|
||||
Similar to @code{xaccAccountGetParent}, but returns the parent Account
|
||||
of the parent Group if the parent Group exists. Otherwise, returns
|
||||
@code{NULL}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetBalance (Account * @var{account})
|
||||
Return the balance of @var{account}, which is also the balance of the
|
||||
last Split in @var{account}. If there are no Splits, the balance is
|
||||
zero. The balance is denominated in the Account currency.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetClearedBalance (Account * @var{account})
|
||||
Return the cleared balance of @var{account}. The cleared balance is the
|
||||
balance of all Splits in @var{account} which are either cleared or
|
||||
reconciled or frozen. The cleared balance is denominated in the Account
|
||||
currency.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetReconciledBalance (Account * @var{account})
|
||||
Return the reconciled balance of @var{account}. The reconciled balance
|
||||
is the balance of all Splits in @var{account} which are reconciled or
|
||||
frozen. The reconciled balance is denominated in the Account currency.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetShareBalance (Account *account)
|
||||
Return the share balance of @var{account}, which is also the share
|
||||
balance of the last Split in @var{account}. If there are no Splits, the
|
||||
balance is zero. The balance is denominated in the Account security, if
|
||||
the Account security exits; otherwise the share balance is denominated
|
||||
in the Account currency.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetShareClearedBalance (Account * @var{account})
|
||||
Return the cleared share balance of @var{account}. The cleared share
|
||||
balance is the share balance of all Splits in @var{account} which are
|
||||
either cleared or reconciled or frozen. The cleared share balance is
|
||||
denominated as the share balance.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetShareReconciledBalance (Account * @var{account})
|
||||
Return the reconciled share balance of @var{account}. The reconciled
|
||||
share balance is the share balance of all Splits in @var{account} which
|
||||
are reconciled or frozen. The reconciled sharea balance is denominated
|
||||
as the share balance.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetBalanceAsOfDate (Account * @var{account}, time_t @var{date})
|
||||
Return the balance of @var{account} including all Splits whose parent
|
||||
Transactions have posted dates on or before @var{date}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gnc_numeric xaccAccountGetShareBalanceAsOfDate (Account * @var{account}, time_t @var{date})
|
||||
Return the share balance of @var{account} including all Splits whose
|
||||
parent Transactions have posted dates on or before @var{date}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {Split *} xaccAccountGetSplit (Account * @var{account}, int @var{i})
|
||||
Return the @var{i}th Split in @var{account}. If @var{i} < 0 or @var{i}
|
||||
>= number of splits in @var{account}, then @code{NULL} is returned.
|
||||
This function is O(number of splits in account).
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int xaccAccountGetNumSplits (Account * @var{account})
|
||||
Return the number of Splits in @var{account}. This function is
|
||||
O(number of splits in account).
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {GList *} xaccAccountGetSplitList (Account * @var{account})
|
||||
Return a @code{GList} of the Splits in @var{account}. This list must
|
||||
not be modified in any way.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@node Account Groups, GNCBooks, Accounts, Engine
|
||||
@section Account Groups
|
||||
|
@ -770,9 +770,9 @@ price_xfer(Split * s, gnc_numeric share_count) {
|
||||
void
|
||||
xaccAccountRecomputeBalance (Account * acc)
|
||||
{
|
||||
gnc_numeric dbalance;
|
||||
gnc_numeric dcleared_balance;
|
||||
gnc_numeric dreconciled_balance;
|
||||
gnc_numeric balance;
|
||||
gnc_numeric cleared_balance;
|
||||
gnc_numeric reconciled_balance;
|
||||
gnc_numeric share_balance;
|
||||
gnc_numeric share_cleared_balance;
|
||||
gnc_numeric share_reconciled_balance;
|
||||
@ -784,9 +784,9 @@ xaccAccountRecomputeBalance (Account * acc)
|
||||
if(!acc->balance_dirty) return;
|
||||
if(acc->do_free) return;
|
||||
|
||||
dbalance = acc->starting_balance;
|
||||
dcleared_balance = acc->starting_cleared_balance;
|
||||
dreconciled_balance = acc->starting_reconciled_balance;
|
||||
balance = acc->starting_balance;
|
||||
cleared_balance = acc->starting_cleared_balance;
|
||||
reconciled_balance = acc->starting_reconciled_balance;
|
||||
share_balance = acc->starting_share_balance;
|
||||
share_cleared_balance = acc->starting_share_cleared_balance;
|
||||
share_reconciled_balance = acc->starting_share_reconciled_balance;
|
||||
@ -796,20 +796,21 @@ xaccAccountRecomputeBalance (Account * acc)
|
||||
|
||||
/* compute both dollar and share balances */
|
||||
share_balance = gnc_numeric_add_fixed(share_balance, split->damount);
|
||||
dbalance = gnc_numeric_add_fixed(dbalance, split->value);
|
||||
balance = gnc_numeric_add_fixed(balance, split->value);
|
||||
|
||||
if( NREC != split -> reconciled ) {
|
||||
share_cleared_balance =
|
||||
gnc_numeric_add_fixed(share_cleared_balance, split->damount);
|
||||
dcleared_balance =
|
||||
gnc_numeric_add_fixed(dcleared_balance, split->value);
|
||||
cleared_balance =
|
||||
gnc_numeric_add_fixed(cleared_balance, split->value);
|
||||
}
|
||||
|
||||
if( YREC == split -> reconciled ) {
|
||||
if( YREC == split -> reconciled ||
|
||||
FREC == split -> reconciled ) {
|
||||
share_reconciled_balance =
|
||||
gnc_numeric_add_fixed(share_cleared_balance, split->damount);
|
||||
dreconciled_balance =
|
||||
gnc_numeric_add_fixed(dreconciled_balance, split->value);
|
||||
reconciled_balance =
|
||||
gnc_numeric_add_fixed(reconciled_balance, split->value);
|
||||
}
|
||||
|
||||
/* For bank accounts, the invariant subtotal is the dollar
|
||||
@ -826,12 +827,12 @@ xaccAccountRecomputeBalance (Account * acc)
|
||||
price_xfer(split, share_reconciled_balance);
|
||||
}
|
||||
else {
|
||||
split -> share_balance = dbalance;
|
||||
split -> share_cleared_balance = dcleared_balance;
|
||||
split -> share_reconciled_balance = dreconciled_balance;
|
||||
split -> balance = dbalance;
|
||||
split -> cleared_balance = dcleared_balance;
|
||||
split -> reconciled_balance = dreconciled_balance;
|
||||
split -> share_balance = balance;
|
||||
split -> share_cleared_balance = cleared_balance;
|
||||
split -> share_reconciled_balance = reconciled_balance;
|
||||
split -> balance = balance;
|
||||
split -> cleared_balance = cleared_balance;
|
||||
split -> reconciled_balance = reconciled_balance;
|
||||
}
|
||||
|
||||
last_split = split;
|
||||
@ -846,21 +847,21 @@ xaccAccountRecomputeBalance (Account * acc)
|
||||
if (last_split) {
|
||||
acc -> balance = price_xfer(last_split, share_balance);
|
||||
acc -> cleared_balance = price_xfer(last_split, share_cleared_balance);
|
||||
acc -> reconciled_balance =
|
||||
acc -> reconciled_balance =
|
||||
price_xfer(last_split, share_reconciled_balance);
|
||||
}
|
||||
else {
|
||||
acc -> balance = dbalance;
|
||||
acc -> cleared_balance = dcleared_balance;
|
||||
acc -> reconciled_balance = dreconciled_balance;
|
||||
acc -> balance = balance;
|
||||
acc -> cleared_balance = cleared_balance;
|
||||
acc -> reconciled_balance = reconciled_balance;
|
||||
}
|
||||
} else {
|
||||
acc -> share_balance = dbalance;
|
||||
acc -> share_cleared_balance = dcleared_balance;
|
||||
acc -> share_reconciled_balance = dreconciled_balance;
|
||||
acc -> balance = dbalance;
|
||||
acc -> cleared_balance = dcleared_balance;
|
||||
acc -> reconciled_balance = dreconciled_balance;
|
||||
acc -> share_balance = balance;
|
||||
acc -> share_cleared_balance = cleared_balance;
|
||||
acc -> share_reconciled_balance = reconciled_balance;
|
||||
acc -> balance = balance;
|
||||
acc -> cleared_balance = cleared_balance;
|
||||
acc -> reconciled_balance = reconciled_balance;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user