本文整理汇总了C++中xaccSplitGetParent函数的典型用法代码示例。如果您正苦于以下问题:C++ xaccSplitGetParent函数的具体用法?C++ xaccSplitGetParent怎么用?C++ xaccSplitGetParent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xaccSplitGetParent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xaccAccountScrubImbalance
void
xaccAccountScrubImbalance (Account *acc)
{
GList *node, *splits;
const char *str;
gint split_count = 0, curr_split_no = 1;
if (!acc) return;
str = xaccAccountGetName(acc);
str = str ? str : "(null)";
PINFO ("Looking for imbalance in account %s \n", str);
splits = xaccAccountGetSplitList(acc);
split_count = g_list_length (splits);
for (node = splits; node; node = node->next)
{
Split *split = node->data;
Transaction *trans = xaccSplitGetParent(split);
PINFO("Start processing split %d of %d",
curr_split_no, split_count);
xaccTransScrubCurrency(trans);
xaccTransScrubImbalance (trans, gnc_account_get_root (acc), NULL);
PINFO("Finished processing split %d of %d",
curr_split_no, split_count);
curr_split_no++;
}
}
示例2: gtu_sr_use_security
/* Is current split a security account */
static gboolean
gtu_sr_use_security (GncTreeViewSplitReg *view)
{
RowDepth depth;
Account *account = NULL;
Split *split;
split = gnc_tree_view_split_reg_get_current_split (view);
depth = gnc_tree_view_reg_get_selected_row_depth (view);
if (!split)
return TRUE;
if (depth != SPLIT3)
return TRUE;
if (!account)
account = xaccSplitGetAccount (split);
if (!account)
return TRUE;
if (xaccTransUseTradingAccounts (xaccSplitGetParent (split)))
{
if (!gnc_commodity_is_iso (xaccAccountGetCommodity (account)))
return TRUE;
}
return xaccAccountIsPriced (account);
}
示例3: delete_template_trans
static void
delete_template_trans(SchedXaction *sx)
{
GList *templ_acct_splits, *curr_split_listref;
Split *curr_split;
Transaction *split_trans;
GList *templ_acct_transactions = NULL;
templ_acct_splits
= xaccAccountGetSplitList(sx->template_acct);
for (curr_split_listref = templ_acct_splits;
curr_split_listref;
curr_split_listref = curr_split_listref->next)
{
curr_split = (Split *) curr_split_listref->data;
split_trans = xaccSplitGetParent(curr_split);
if (! (g_list_find(templ_acct_transactions, split_trans)))
{
templ_acct_transactions
= g_list_prepend(templ_acct_transactions, split_trans);
}
}
g_list_foreach(templ_acct_transactions,
sxprivTransMapDelete,
NULL);
return;
}
示例4: xaccAccountScrubOrphans
void
xaccAccountScrubOrphans (Account *acc, QofPercentageFunc percentagefunc)
{
GList *node, *splits;
const char *str;
const char *message = _( "Looking for orphans in account %s: %u of %u");
guint total_splits = 0;
guint current_split = 0;
if (!acc) return;
str = xaccAccountGetName (acc);
str = str ? str : "(null)";
PINFO ("Looking for orphans in account %s \n", str);
splits = xaccAccountGetSplitList(acc);
total_splits = g_list_length (splits);
for (node = splits; node; node = node->next)
{
Split *split = node->data;
if (current_split % 100 == 0)
{
char *progress_msg = g_strdup_printf (message, str, current_split, total_splits);
(percentagefunc)(progress_msg, (100 * current_split) / total_splits);
g_free (progress_msg);
}
TransScrubOrphansFast (xaccSplitGetParent (split),
gnc_account_get_root (acc));
current_split++;
}
(percentagefunc)(NULL, -1.0);
}
示例5: gnc_split_register_save_num_cell
static void
gnc_split_register_save_num_cell (BasicCell * cell,
gpointer save_data,
gpointer user_data)
{
SRSaveData *sd = save_data;
SplitRegister *reg = user_data;
const char *value;
g_return_if_fail (gnc_basic_cell_has_name (cell, NUM_CELL));
value = gnc_basic_cell_get_value (cell);
DEBUG ("NUM: %s\n", value ? value : "(null)");
/* set per book option */
gnc_set_num_action (sd->trans, sd->split, value, NULL);
if (gnc_num_cell_set_last_num ((NumCell *) cell, value))
{
SRInfo *info = gnc_split_register_get_info (reg);
Split *blank_split = xaccSplitLookup (&info->blank_split_guid,
gnc_get_current_book ());
Transaction *blank_trans = xaccSplitGetParent (blank_split);
if (sd->trans == blank_trans)
gnc_split_register_set_last_num (reg, gnc_basic_cell_get_value (cell));
}
}
示例6: gncScrubLotIsSingleLotLinkSplit
static gboolean
gncScrubLotIsSingleLotLinkSplit (GNCLot *lot)
{
Split *split = NULL;
Transaction *trans = NULL;
// Lots with a single split which is also a lot link transaction split
// may be sign of a dangling payment. Let's try to fix that
// Only works for single split lots...
if (1 != gnc_lot_count_splits (lot))
return FALSE;
split = gnc_lot_get_earliest_split (lot);
trans = xaccSplitGetParent (split);
if (!trans)
{
// Ooops - the split doesn't belong to any transaction !
// This is not expected so issue a warning and continue with next split
PWARN("Encountered a split in a business lot that's not part of any transaction. "
"This is unexpected! Skipping split %p.", split);
return FALSE;
}
// Only works if single split belongs to a lot link transaction...
if (xaccTransGetTxnType (trans) != TXN_TYPE_LINK)
return FALSE;
return TRUE;
}
示例7: gncOwnerReduceSplitTo
gboolean
gncOwnerReduceSplitTo (Split *split, gnc_numeric target_value)
{
gnc_numeric split_val = xaccSplitGetValue (split);
gnc_numeric rem_val;
Split *rem_split;
Transaction *txn;
GNCLot *lot;
if (gnc_numeric_positive_p (split_val) != gnc_numeric_positive_p (target_value))
return FALSE; // Split and target value have to be of the same sign
if (gnc_numeric_equal (split_val, target_value))
return FALSE; // Split already has the target value
rem_val = gnc_numeric_sub (split_val, target_value, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD); // note: values are of opposite sign
rem_split = xaccMallocSplit (xaccSplitGetBook (split));
xaccSplitCopyOnto (split, rem_split);
xaccSplitSetValue (rem_split, rem_val);
txn = xaccSplitGetParent (split);
xaccTransBeginEdit (txn);
xaccSplitSetValue (split, target_value);
xaccSplitSetParent (rem_split, txn);
xaccTransCommitEdit (txn);
lot = xaccSplitGetLot (split);
gnc_lot_add_split (lot, rem_split);
return TRUE;
}
示例8: gnc_tree_util_split_reg_is_multi
/* Is this split part of a multi split transaction */
gboolean
gnc_tree_util_split_reg_is_multi (Split *split)
{
gboolean multi = FALSE;
Split *osplit;
if (!split)
return FALSE;
osplit = xaccSplitGetOtherSplit (split);
if (osplit)
multi = FALSE;
else
{
/* For multi-split transactions and stock splits,
* use a special value. */
osplit = xaccTransGetSplit (xaccSplitGetParent (split), 1);
if (osplit)
multi = TRUE;
else if (g_strcmp0 ("stock-split", xaccSplitGetType (split)) == 0)
multi = TRUE;
else
multi = FALSE;
}
return multi;
}
示例9: _find_split_with_parent_txn
static gint
_find_split_with_parent_txn(gconstpointer a, gconstpointer b)
{
Split *split = (Split*)a;
Transaction *txn = (Transaction*)b;
return xaccSplitGetParent(split) == txn ? 0 : 1;
}
示例10: gnc_split_register_split_needs_amount
gboolean
gnc_split_register_split_needs_amount (SplitRegister *reg, Split *split)
{
Transaction *txn = xaccSplitGetParent (split);
Account *acc = xaccSplitGetAccount (split);
return gnc_split_register_needs_conv_rate (reg, txn, acc);
}
示例11: gnc_tree_util_split_reg_needs_amount
gboolean
gnc_tree_util_split_reg_needs_amount (GncTreeViewSplitReg *view, Split *split)
{
Transaction *txn = xaccSplitGetParent (split);
Account *acc = xaccSplitGetAccount (split);
return gnc_tree_util_split_reg_needs_conv_rate (view, txn, acc);
}
示例12: xaccAccountScrubImbalance
void
xaccAccountScrubImbalance (Account *acc, QofPercentageFunc percentagefunc)
{
GList *node, *splits;
const char *str;
const char *message = _( "Looking for imbalances in account %s: %u of %u");
gint split_count = 0, curr_split_no = 0;
if (!acc) return;
str = xaccAccountGetName(acc);
str = str ? str : "(null)";
PINFO ("Looking for imbalances in account %s \n", str);
splits = xaccAccountGetSplitList(acc);
split_count = g_list_length (splits);
for (node = splits; node; node = node->next)
{
Split *split = node->data;
Transaction *trans = xaccSplitGetParent(split);
PINFO("Start processing split %d of %d",
curr_split_no + 1, split_count);
if (curr_split_no % 100 == 0)
{
char *progress_msg = g_strdup_printf (message, str, curr_split_no, split_count);
(percentagefunc)(progress_msg, (100 * curr_split_no) / split_count);
g_free (progress_msg);
}
TransScrubOrphansFast (xaccSplitGetParent (split),
gnc_account_get_root (acc));
(percentagefunc)(NULL, 0.0);
xaccTransScrubCurrency(trans);
xaccTransScrubImbalance (trans, gnc_account_get_root (acc), NULL);
PINFO("Finished processing split %d of %d",
curr_split_no + 1, split_count);
curr_split_no++;
}
(percentagefunc)(NULL, -1.0);
}
示例13: gnc_import_set_split_online_id
/* Used several places in a transaction edit where many other
* parameters are also being set, so individual commits wouldn't be
* appropriate. */
void gnc_import_set_split_online_id(Split * split,
const gchar * string_value)
{
kvp_frame * frame;
xaccTransBeginEdit (xaccSplitGetParent (split));
frame = xaccSplitGetSlots(split);
kvp_frame_set_str (frame, "online_id", string_value);
qof_instance_set_dirty (QOF_INSTANCE (split));
}
示例14: gncScrubBusinessLot
gboolean
gncScrubBusinessLot (GNCLot *lot)
{
gboolean splits_deleted = FALSE;
gboolean dangling_payments = FALSE;
gboolean dangling_lot_link = FALSE;
Account *acc;
gchar *lotname=NULL;
if (!lot) return FALSE;
lotname = g_strdup (gnc_lot_get_title (lot));
ENTER ("(lot=%p) %s", lot, lotname ? lotname : "(no lotname)");
acc = gnc_lot_get_account (lot);
if (acc)
xaccAccountBeginEdit(acc);
// Scrub lot links.
// They should only remain when two document lots are linked together
xaccScrubMergeLotSubSplits (lot, FALSE);
splits_deleted = gncScrubLotLinks (lot);
// Look for dangling payments and repair if found
dangling_lot_link = gncScrubLotIsSingleLotLinkSplit (lot);
if (dangling_lot_link)
{
dangling_payments = gncScrubLotDanglingPayments (lot);
if (dangling_payments)
splits_deleted |= gncScrubLotLinks (lot);
else
{
Split *split = gnc_lot_get_earliest_split (lot);
Transaction *trans = xaccSplitGetParent (split);
xaccTransDestroy (trans);
}
}
// If lot is empty now, delete it
if (0 == gnc_lot_count_splits (lot))
{
PINFO("All splits were removed from lot, deleting");
gnc_lot_destroy (lot);
}
if (acc)
xaccAccountCommitEdit(acc);
LEAVE ("(lot=%s, deleted=%d, dangling lot link=%d, dangling_payments=%d)",
lotname ? lotname : "(no lotname)", splits_deleted, dangling_lot_link,
dangling_payments);
g_free (lotname);
return splits_deleted;
}
示例15: gncOwnerLotsSortFunc
gint
gncOwnerLotsSortFunc (GNCLot *lotA, GNCLot *lotB)
{
GncInvoice *ia, *ib;
Timespec da, db;
ia = gncInvoiceGetInvoiceFromLot (lotA);
ib = gncInvoiceGetInvoiceFromLot (lotB);
if (ia)
da = gncInvoiceGetDateDue (ia);
else
da = xaccTransRetDatePostedTS (xaccSplitGetParent (gnc_lot_get_earliest_split (lotA)));
if (ib)
db = gncInvoiceGetDateDue (ib);
else
db = xaccTransRetDatePostedTS (xaccSplitGetParent (gnc_lot_get_earliest_split (lotB)));
return timespec_cmp (&da, &db);
}