Account.cpp (gnucash-5.0.tar.bz2) | : | Account.cpp (gnucash-5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 331 | skipping to change at line 331 | |||
priv->balance = gnc_numeric_zero(); | priv->balance = gnc_numeric_zero(); | |||
priv->noclosing_balance = gnc_numeric_zero(); | priv->noclosing_balance = gnc_numeric_zero(); | |||
priv->cleared_balance = gnc_numeric_zero(); | priv->cleared_balance = gnc_numeric_zero(); | |||
priv->reconciled_balance = gnc_numeric_zero(); | priv->reconciled_balance = gnc_numeric_zero(); | |||
priv->starting_balance = gnc_numeric_zero(); | priv->starting_balance = gnc_numeric_zero(); | |||
priv->starting_noclosing_balance = gnc_numeric_zero(); | priv->starting_noclosing_balance = gnc_numeric_zero(); | |||
priv->starting_cleared_balance = gnc_numeric_zero(); | priv->starting_cleared_balance = gnc_numeric_zero(); | |||
priv->starting_reconciled_balance = gnc_numeric_zero(); | priv->starting_reconciled_balance = gnc_numeric_zero(); | |||
priv->balance_dirty = FALSE; | priv->balance_dirty = FALSE; | |||
priv->higher_balance_limit = gnc_numeric_create (1,0); | ||||
priv->higher_balance_cached = false; | ||||
priv->lower_balance_limit = gnc_numeric_create (1,0); | ||||
priv->lower_balance_cached = false; | ||||
priv->include_sub_account_balances = TriState::Unset; | ||||
priv->splits = NULL; | priv->splits = NULL; | |||
priv->sort_dirty = FALSE; | priv->sort_dirty = FALSE; | |||
} | } | |||
static void | static void | |||
gnc_account_dispose (GObject *acctp) | gnc_account_dispose (GObject *acctp) | |||
{ | { | |||
G_OBJECT_CLASS(gnc_account_parent_class)->dispose(acctp); | G_OBJECT_CLASS(gnc_account_parent_class)->dispose(acctp); | |||
} | } | |||
skipping to change at line 3918 | skipping to change at line 3924 | |||
xaccAccountGetNoclosingBalanceChangeForPeriod (Account *acc, time64 t1, | xaccAccountGetNoclosingBalanceChangeForPeriod (Account *acc, time64 t1, | |||
time64 t2, gboolean recurse) | time64 t2, gboolean recurse) | |||
{ | { | |||
gnc_numeric b1, b2; | gnc_numeric b1, b2; | |||
b1 = xaccAccountGetNoclosingBalanceAsOfDateInCurrency(acc, t1, NULL, recurse ); | b1 = xaccAccountGetNoclosingBalanceAsOfDateInCurrency(acc, t1, NULL, recurse ); | |||
b2 = xaccAccountGetNoclosingBalanceAsOfDateInCurrency(acc, t2, NULL, recurse ); | b2 = xaccAccountGetNoclosingBalanceAsOfDateInCurrency(acc, t2, NULL, recurse ); | |||
return gnc_numeric_sub(b2, b1, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED); | return gnc_numeric_sub(b2, b1, GNC_DENOM_AUTO, GNC_HOW_DENOM_FIXED); | |||
} | } | |||
typedef struct | ||||
{ | ||||
const gnc_commodity *currency; | ||||
gnc_numeric balanceChange; | ||||
time64 t1; | ||||
time64 t2; | ||||
} CurrencyBalanceChange; | ||||
static void | ||||
xaccAccountBalanceChangeHelper (Account *acc, gpointer data) | ||||
{ | ||||
CurrencyBalanceChange *cbdiff = static_cast<CurrencyBalanceChange*>(data); | ||||
gnc_numeric b1, b2; | ||||
b1 = GetBalanceAsOfDate(acc, cbdiff->t1, TRUE); | ||||
b2 = GetBalanceAsOfDate(acc, cbdiff->t2, TRUE); | ||||
gnc_numeric balanceChange = gnc_numeric_sub(b2, b1, GNC_DENOM_AUTO, GNC_HOW_ | ||||
DENOM_FIXED); | ||||
gnc_numeric balanceChange_conv = xaccAccountConvertBalanceToCurrencyAsOfDate | ||||
(acc, balanceChange, xaccAccountGetCommodity(acc), cbdiff->currency, cbdiff->t2) | ||||
; | ||||
cbdiff->balanceChange = gnc_numeric_add (cbdiff->balanceChange, balanceChang | ||||
e_conv, | ||||
gnc_commodity_get_fraction (cbdiff->currency), | ||||
GNC_HOW_RND_ROUND_HALF_UP); | ||||
} | ||||
gnc_numeric | ||||
xaccAccountGetNoclosingBalanceChangeInCurrencyForPeriod (Account *acc, time64 t1 | ||||
, | ||||
time64 t2, gboolean recurse) | ||||
{ | ||||
gnc_numeric b1, b2; | ||||
b1 = GetBalanceAsOfDate(acc, t1, TRUE); | ||||
b2 = GetBalanceAsOfDate(acc, t2, TRUE); | ||||
gnc_numeric balanceChange = gnc_numeric_sub(b2, b1, GNC_DENOM_AUTO, GNC_HOW_ | ||||
DENOM_FIXED); | ||||
gnc_commodity *report_commodity = xaccAccountGetCommodity(acc); | ||||
CurrencyBalanceChange cbdiff = { report_commodity, balanceChange, t1, t2 }; | ||||
if(recurse) | ||||
{ | ||||
gnc_account_foreach_descendant (acc, xaccAccountBalanceChangeHelper, &cb | ||||
diff); | ||||
balanceChange = cbdiff.balanceChange; | ||||
} | ||||
return balanceChange; | ||||
} | ||||
/********************************************************************\ | /********************************************************************\ | |||
\********************************************************************/ | \********************************************************************/ | |||
/* THIS API NEEDS TO CHANGE. | /* THIS API NEEDS TO CHANGE. | |||
* | * | |||
* This code exposes the internal structure of the account object to | * This code exposes the internal structure of the account object to | |||
* external callers by returning the actual list used by the object. | * external callers by returning the actual list used by the object. | |||
* It should instead return a copy of the split list that the caller | * It should instead return a copy of the split list that the caller | |||
* is required to free. That change would provide the freedom of | * is required to free. That change would provide the freedom of | |||
* allowing the internal organization to change data structures if | * allowing the internal organization to change data structures if | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 57 lines changed or added |