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>
|
2001-07-11 Dave Peticolas <dave@krondo.com>
|
||||||
|
|
||||||
* src/engine/io-gncxml-v2.c: same as below
|
* 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);
|
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
|
gnc_numeric
|
||||||
xaccAccountGetBalance (Account *acc) {
|
xaccAccountGetBalance (Account *acc) {
|
||||||
if (!acc) return gnc_numeric_zero();
|
if (!acc) return gnc_numeric_zero();
|
||||||
@ -1370,52 +1334,24 @@ xaccAccountGetReconciledBalance (Account *acc)
|
|||||||
return acc->reconciled_balance;
|
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
|
gnc_numeric
|
||||||
get_balance_as_of_date (Account *acc, time_t date, gboolean use_shares)
|
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
|
/* Ideally this could use xaccAccountForEachSplit, but
|
||||||
* it doesn't exist yet and I'm uncertain of exactly how
|
* it doesn't exist yet and I'm uncertain of exactly how
|
||||||
* it would work at this time, since it differs from
|
* it would work at this time, since it differs from
|
||||||
* xaccAccountForEachTransaction by using gpointer return
|
* xaccAccountForEachTransaction by using gpointer return
|
||||||
* values rather than gbooleans.
|
* values rather than gbooleans.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GList *lp;
|
GList *lp;
|
||||||
Timespec ts, trans_ts;
|
Timespec ts, trans_ts;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
gnc_numeric balance;
|
gnc_numeric balance;
|
||||||
|
|
||||||
balance = use_shares ?
|
balance = xaccAccountGetBalance( acc );
|
||||||
xaccAccountGetShareBalance( acc ) : xaccAccountGetBalance( acc );
|
|
||||||
|
|
||||||
xaccAccountSortSplits( acc ); /* just in case, normally a nop */
|
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
|
/* Since lp is now pointing to a split which was past the reconcile
|
||||||
* date, get the running balance of the previous split.
|
* date, get the running balance of the previous split.
|
||||||
*/
|
*/
|
||||||
balance = use_shares ?
|
balance = xaccSplitGetBalance( (Split *)lp->prev->data );
|
||||||
xaccSplitGetShareBalance( (Split *)lp->prev->data ) :
|
|
||||||
xaccSplitGetBalance( (Split *)lp->prev->data );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise there were no splits posted after the given date,
|
/* 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 );
|
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 *
|
GList *
|
||||||
xaccAccountGetSplitList (Account *acc) {
|
xaccAccountGetSplitList (Account *acc) {
|
||||||
if (!acc) return NULL;
|
if (!acc) return NULL;
|
||||||
return (acc->splits);
|
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);
|
AccountGroup * xaccAccountGetParent (Account *account);
|
||||||
Account * xaccAccountGetParentAccount (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 xaccAccountGetBalance (Account *account);
|
||||||
gnc_numeric xaccAccountGetClearedBalance (Account *account);
|
gnc_numeric xaccAccountGetClearedBalance (Account *account);
|
||||||
gnc_numeric xaccAccountGetReconciledBalance (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 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);
|
GList* xaccAccountGetSplitList (Account *account);
|
||||||
|
|
||||||
@ -275,13 +259,6 @@ void xaccAccountSetTaxUSPayerNameSource (Account *account,
|
|||||||
*/
|
*/
|
||||||
char * xaccAccountGetFullName (Account *account, const char separator);
|
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 true if the account has 'ancestor' as an ancestor.
|
||||||
* Returns false if either is NULL. */
|
* Returns false if either is NULL. */
|
||||||
gboolean xaccAccountHasAncestor (Account *account, Account *ancestor);
|
gboolean xaccAccountHasAncestor (Account *account, Account *ancestor);
|
||||||
|
@ -110,7 +110,7 @@ fill_account_list (StockSplitInfo *info, Account *account)
|
|||||||
account_type != MUTUAL)
|
account_type != MUTUAL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
balance = xaccAccountGetShareBalance (account);
|
balance = xaccAccountGetBalance (account);
|
||||||
if (gnc_numeric_zero_p (balance))
|
if (gnc_numeric_zero_p (balance))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -122,7 +122,6 @@ typedef struct _startRecnWindowData
|
|||||||
{
|
{
|
||||||
Account *account; /* the account being reconciled */
|
Account *account; /* the account being reconciled */
|
||||||
GNCAccountType account_type; /* the type of the account */
|
GNCAccountType account_type; /* the type of the account */
|
||||||
gboolean use_shares; /* whether to use shares for the account */
|
|
||||||
|
|
||||||
GtkWidget *startRecnWindow; /* the startRecnWindow dialog */
|
GtkWidget *startRecnWindow; /* the startRecnWindow dialog */
|
||||||
GtkWidget *xfer_button; /* the dialog's interest transfer button */
|
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);
|
new_date = gnc_date_edit_get_date_end (gde);
|
||||||
|
|
||||||
/* get the balance for the account as of the new date */
|
/* 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 */
|
/* use the correct sign */
|
||||||
if (gnc_reverse_balance (data->account))
|
if (gnc_reverse_balance (data->account))
|
||||||
@ -508,9 +507,6 @@ gnc_reconcile_interest_xfer_run(startRecnWindowData *data)
|
|||||||
recnInterestXferWindow( data );
|
recnInterestXferWindow( data );
|
||||||
|
|
||||||
/* recompute the ending balance */
|
/* 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. */
|
/* update the ending balance in the startRecnWindow if it has changed. */
|
||||||
@ -580,7 +576,7 @@ startRecnWindow(GtkWidget *parent, Account *account,
|
|||||||
auto_interest_xfer_option =
|
auto_interest_xfer_option =
|
||||||
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account );
|
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account );
|
||||||
|
|
||||||
ending = xaccAccountGetShareReconciledBalance(account);
|
ending = xaccAccountGetReconciledBalance(account);
|
||||||
print_info = gnc_account_print_info (account, TRUE);
|
print_info = gnc_account_print_info (account, TRUE);
|
||||||
|
|
||||||
if (gnc_reverse_balance(account))
|
if (gnc_reverse_balance(account))
|
||||||
@ -2056,7 +2052,7 @@ find_payment_account(Account *account)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* ignore 'purchases' */
|
/* ignore 'purchases' */
|
||||||
if (!gnc_numeric_positive_p (xaccSplitGetShareAmount(split)))
|
if (!gnc_numeric_positive_p (xaccSplitGetAmount(split)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
trans = xaccSplitGetParent(split);
|
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);
|
print_info = gnc_account_print_info (leader, TRUE);
|
||||||
|
|
||||||
amount = xaccAccountGetShareBalance (leader);
|
amount = xaccAccountGetBalance (leader);
|
||||||
if (reverse)
|
if (reverse)
|
||||||
amount = gnc_numeric_neg (amount);
|
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);
|
print_info = gnc_commodity_print_info (currency, TRUE);
|
||||||
|
|
||||||
amount = xaccAccountGetShareBalance (leader);
|
amount = xaccAccountGetBalance (leader);
|
||||||
if (reverse)
|
if (reverse)
|
||||||
amount = gnc_numeric_neg (amount);
|
amount = gnc_numeric_neg (amount);
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@
|
|||||||
((stksplit)
|
((stksplit)
|
||||||
(let* ((splitratio (n/ num-shares (gnc:numeric-create 10 1)))
|
(let* ((splitratio (n/ num-shares (gnc:numeric-create 10 1)))
|
||||||
(in-shares
|
(in-shares
|
||||||
(gnc:account-get-share-balance near-acct))
|
(gnc:account-get-balance near-acct))
|
||||||
(out-shares (n* in-shares splitratio)))
|
(out-shares (n* in-shares splitratio)))
|
||||||
(gnc:split-set-share-amount gnc-near-split out-shares)
|
(gnc:split-set-share-amount gnc-near-split out-shares)
|
||||||
(gnc:split-set-share-amount gnc-far-split (n- in-shares))
|
(gnc:split-set-share-amount gnc-far-split (n- in-shares))
|
||||||
|
Loading…
Reference in New Issue
Block a user