mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-07-12 Dave Peticolas <dave@krondo.com>
* src/gnome/druid-stock-split.c: remove share api * src/engine/Account.[ch]: remove 'share' api and other unused api. * src/scm/qif-import/qif-to-gnc.scm: remove share api * src/guile/gnc.gwp: remove share api * src/gnome/window-reconcile.c: remove share api * src/gnome/window-register.c: remove share api git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4945 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
c8fcd36996
commit
91973a0430
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2001-07-12 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnome/druid-stock-split.c: remove share api
|
||||
|
||||
* src/engine/Account.[ch]: remove 'share' api and other
|
||||
unused api.
|
||||
|
||||
* src/scm/qif-import/qif-to-gnc.scm: remove share api
|
||||
|
||||
* src/guile/gnc.gwp: remove share api
|
||||
|
||||
* src/gnome/window-reconcile.c: remove share api
|
||||
|
||||
* src/gnome/window-register.c: remove share api
|
||||
|
||||
2001-07-11 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/engine/io-gncxml-v2.c: same as below
|
||||
|
@ -1314,42 +1314,6 @@ DxaccAccountGetSecurity (Account *acc)
|
||||
return gnc_commodity_table_lookup_unique (gnc_engine_commodities (), s);
|
||||
}
|
||||
|
||||
double
|
||||
DxaccAccountGetBalance (Account *acc)
|
||||
{
|
||||
return gnc_numeric_to_double(xaccAccountGetBalance(acc));
|
||||
}
|
||||
|
||||
double
|
||||
DxaccAccountGetClearedBalance (Account *acc)
|
||||
{
|
||||
return gnc_numeric_to_double(xaccAccountGetClearedBalance(acc));
|
||||
}
|
||||
|
||||
double
|
||||
DxaccAccountGetReconciledBalance (Account *acc)
|
||||
{
|
||||
return gnc_numeric_to_double(xaccAccountGetReconciledBalance(acc));
|
||||
}
|
||||
|
||||
double
|
||||
DxaccAccountGetShareBalance (Account *acc)
|
||||
{
|
||||
return gnc_numeric_to_double(xaccAccountGetShareBalance(acc));
|
||||
}
|
||||
|
||||
double
|
||||
DxaccAccountGetShareClearedBalance (Account *acc)
|
||||
{
|
||||
return gnc_numeric_to_double(xaccAccountGetShareClearedBalance(acc));
|
||||
}
|
||||
|
||||
double
|
||||
DxaccAccountGetShareReconciledBalance (Account *acc)
|
||||
{
|
||||
return gnc_numeric_to_double(xaccAccountGetShareReconciledBalance(acc));
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetBalance (Account *acc) {
|
||||
if (!acc) return gnc_numeric_zero();
|
||||
@ -1370,52 +1334,24 @@ xaccAccountGetReconciledBalance (Account *acc)
|
||||
return acc->reconciled_balance;
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetShareBalance (Account *acc)
|
||||
{
|
||||
if (!acc) return gnc_numeric_zero();
|
||||
return acc->balance;
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetShareClearedBalance (Account *acc)
|
||||
{
|
||||
if (!acc) return gnc_numeric_zero();
|
||||
return acc->cleared_balance;
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetShareReconciledBalance (Account *acc)
|
||||
{
|
||||
if (!acc) return gnc_numeric_zero();
|
||||
return acc->reconciled_balance;
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
static gnc_numeric
|
||||
get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares)
|
||||
gnc_numeric
|
||||
xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)
|
||||
{
|
||||
/* This is common code to handle both xaccAccountGetBalanceAsOfDate
|
||||
* and xaccAccountGetShareBalanceAsOfDate. use_shares is TRUE if the
|
||||
* share balance is being requested.
|
||||
*/
|
||||
|
||||
/* Ideally this could use xaccAccountForEachSplit, but
|
||||
* it doesn't exist yet and I'm uncertain of exactly how
|
||||
* it would work at this time, since it differs from
|
||||
* xaccAccountForEachTransaction by using gpointer return
|
||||
* values rather than gbooleans.
|
||||
*/
|
||||
|
||||
GList *lp;
|
||||
Timespec ts, trans_ts;
|
||||
gboolean found = FALSE;
|
||||
gnc_numeric balance;
|
||||
|
||||
balance = use_shares ?
|
||||
xaccAccountGetShareBalance( acc ) : xaccAccountGetBalance( acc );
|
||||
|
||||
balance = xaccAccountGetBalance( acc );
|
||||
|
||||
xaccAccountSortSplits( acc ); /* just in case, normally a nop */
|
||||
|
||||
@ -1454,9 +1390,7 @@ get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares)
|
||||
/* Since lp is now pointing to a split which was past the reconcile
|
||||
* date, get the running balance of the previous split.
|
||||
*/
|
||||
balance = use_shares ?
|
||||
xaccSplitGetShareBalance( (Split *)lp->prev->data ) :
|
||||
xaccSplitGetBalance( (Split *)lp->prev->data );
|
||||
balance = xaccSplitGetBalance( (Split *)lp->prev->data );
|
||||
}
|
||||
|
||||
/* Otherwise there were no splits posted after the given date,
|
||||
@ -1466,43 +1400,15 @@ get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares)
|
||||
return( balance );
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetBalanceAsOfDate (Account *acc, time_t date)
|
||||
{
|
||||
return( get_balance_as_of_date( acc, date, FALSE ) );
|
||||
}
|
||||
|
||||
gnc_numeric
|
||||
xaccAccountGetShareBalanceAsOfDate (Account *acc, time_t date)
|
||||
{
|
||||
return( get_balance_as_of_date( acc, date, TRUE ) );
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
Split *
|
||||
xaccAccountGetSplit(Account *acc, int i) {
|
||||
GList *result;
|
||||
|
||||
if (!acc) return(NULL);
|
||||
result = g_list_nth(acc->splits, i);
|
||||
if(!result) return(NULL);
|
||||
return((Split *) result->data);
|
||||
}
|
||||
|
||||
GList *
|
||||
xaccAccountGetSplitList (Account *acc) {
|
||||
if (!acc) return NULL;
|
||||
return (acc->splits);
|
||||
}
|
||||
|
||||
int
|
||||
xaccAccountGetNumSplits (Account *acc) {
|
||||
if (!acc) return 0;
|
||||
return g_list_length(acc->splits);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
\********************************************************************/
|
||||
|
||||
|
@ -226,27 +226,11 @@ AccountGroup * xaccAccountGetChildren (Account *account);
|
||||
AccountGroup * xaccAccountGetParent (Account *account);
|
||||
Account * xaccAccountGetParentAccount (Account *account);
|
||||
|
||||
/* deprecated old double API : this will go away! */
|
||||
double DxaccAccountGetBalance (Account *account);
|
||||
double DxaccAccountGetClearedBalance (Account *account);
|
||||
double DxaccAccountGetReconciledBalance (Account *account);
|
||||
double DxaccAccountGetShareBalance (Account *account);
|
||||
double DxaccAccountGetShareClearedBalance (Account *account);
|
||||
double DxaccAccountGetShareReconciledBalance (Account *account);
|
||||
|
||||
gnc_numeric xaccAccountGetBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetClearedBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetReconciledBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetShareBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetShareClearedBalance (Account *account);
|
||||
gnc_numeric xaccAccountGetShareReconciledBalance (Account *account);
|
||||
|
||||
gnc_numeric xaccAccountGetBalanceAsOfDate (Account *account, time_t date);
|
||||
gnc_numeric xaccAccountGetShareBalanceAsOfDate (Account *account,
|
||||
time_t date);
|
||||
|
||||
Split * xaccAccountGetSplit (Account *account, int i);
|
||||
int xaccAccountGetNumSplits (Account *account);
|
||||
|
||||
GList* xaccAccountGetSplitList (Account *account);
|
||||
|
||||
@ -275,13 +259,6 @@ void xaccAccountSetTaxUSPayerNameSource (Account *account,
|
||||
*/
|
||||
char * xaccAccountGetFullName (Account *account, const char separator);
|
||||
|
||||
/* xaccAccountsHaveCommonCurrency returns true if the two given accounts
|
||||
* have a currency in common, i.e., if they can have common transactions.
|
||||
* Useful for UI sanity checks.
|
||||
*/
|
||||
gboolean xaccAccountsHaveCommonCurrency(Account *account_1,
|
||||
Account *account_2);
|
||||
|
||||
/* Returns true if the account has 'ancestor' as an ancestor.
|
||||
* Returns false if either is NULL. */
|
||||
gboolean xaccAccountHasAncestor (Account *account, Account *ancestor);
|
||||
|
@ -110,7 +110,7 @@ fill_account_list (StockSplitInfo *info, Account *account)
|
||||
account_type != MUTUAL)
|
||||
continue;
|
||||
|
||||
balance = xaccAccountGetShareBalance (account);
|
||||
balance = xaccAccountGetBalance (account);
|
||||
if (gnc_numeric_zero_p (balance))
|
||||
continue;
|
||||
|
||||
|
@ -122,7 +122,6 @@ typedef struct _startRecnWindowData
|
||||
{
|
||||
Account *account; /* the account being reconciled */
|
||||
GNCAccountType account_type; /* the type of the account */
|
||||
gboolean use_shares; /* whether to use shares for the account */
|
||||
|
||||
GtkWidget *startRecnWindow; /* the startRecnWindow dialog */
|
||||
GtkWidget *xfer_button; /* the dialog's interest transfer button */
|
||||
@ -320,7 +319,7 @@ gnc_start_recn_date_changed (GtkWidget *widget, startRecnWindowData *data)
|
||||
new_date = gnc_date_edit_get_date_end (gde);
|
||||
|
||||
/* get the balance for the account as of the new date */
|
||||
xaccAccountGetBalanceAsOfDate (data->account, new_date);
|
||||
new_balance = xaccAccountGetBalanceAsOfDate (data->account, new_date);
|
||||
|
||||
/* use the correct sign */
|
||||
if (gnc_reverse_balance (data->account))
|
||||
@ -508,10 +507,7 @@ gnc_reconcile_interest_xfer_run(startRecnWindowData *data)
|
||||
recnInterestXferWindow( data );
|
||||
|
||||
/* recompute the ending balance */
|
||||
if (data->use_shares)
|
||||
after = xaccAccountGetShareBalanceAsOfDate(data->account, data->date);
|
||||
else
|
||||
after = xaccAccountGetBalanceAsOfDate(data->account, data->date);
|
||||
after = xaccAccountGetBalanceAsOfDate(data->account, data->date);
|
||||
|
||||
/* update the ending balance in the startRecnWindow if it has changed. */
|
||||
if( gnc_numeric_compare( before, after ) )
|
||||
@ -580,7 +576,7 @@ startRecnWindow(GtkWidget *parent, Account *account,
|
||||
auto_interest_xfer_option =
|
||||
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account );
|
||||
|
||||
ending = xaccAccountGetShareReconciledBalance(account);
|
||||
ending = xaccAccountGetReconciledBalance(account);
|
||||
print_info = gnc_account_print_info (account, TRUE);
|
||||
|
||||
if (gnc_reverse_balance(account))
|
||||
@ -2056,7 +2052,7 @@ find_payment_account(Account *account)
|
||||
continue;
|
||||
|
||||
/* ignore 'purchases' */
|
||||
if (!gnc_numeric_positive_p (xaccSplitGetShareAmount(split)))
|
||||
if (!gnc_numeric_positive_p (xaccSplitGetAmount(split)))
|
||||
continue;
|
||||
|
||||
trans = xaccSplitGetParent(split);
|
||||
|
@ -2370,7 +2370,7 @@ gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
|
||||
{
|
||||
print_info = gnc_account_print_info (leader, TRUE);
|
||||
|
||||
amount = xaccAccountGetShareBalance (leader);
|
||||
amount = xaccAccountGetBalance (leader);
|
||||
if (reverse)
|
||||
amount = gnc_numeric_neg (amount);
|
||||
|
||||
@ -2397,7 +2397,7 @@ gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data)
|
||||
|
||||
print_info = gnc_commodity_print_info (currency, TRUE);
|
||||
|
||||
amount = xaccAccountGetShareBalance (leader);
|
||||
amount = xaccAccountGetBalance (leader);
|
||||
if (reverse)
|
||||
amount = gnc_numeric_neg (amount);
|
||||
|
||||
|
@ -595,7 +595,7 @@
|
||||
((stksplit)
|
||||
(let* ((splitratio (n/ num-shares (gnc:numeric-create 10 1)))
|
||||
(in-shares
|
||||
(gnc:account-get-share-balance near-acct))
|
||||
(gnc:account-get-balance near-acct))
|
||||
(out-shares (n* in-shares splitratio)))
|
||||
(gnc:split-set-share-amount gnc-near-split out-shares)
|
||||
(gnc:split-set-share-amount gnc-far-split (n- in-shares))
|
||||
|
Loading…
Reference in New Issue
Block a user