void xaccAccountTreeScrubImbalance (Account *acc, QofPercentageFunc percentagefunc) { xaccAccountScrubImbalance (acc, percentagefunc); gnc_account_foreach_descendant(acc, (AccountCb)xaccAccountScrubImbalance, percentagefunc); }
void xaccAccountTreeScrubImbalance (Account *acc) { xaccAccountScrubImbalance (acc); gnc_account_foreach_descendant(acc, (AccountCb)xaccAccountScrubImbalance, NULL); }
void gncScrubBusinessAccountTree (Account *acc) { if (!acc) return; gnc_account_foreach_descendant(acc, lot_scrub_cb, NULL); gncScrubBusinessAccount (acc); }
void xaccAccountTreeScrubOrphans (Account *acc, QofPercentageFunc percentagefunc) { if (!acc) return; xaccAccountScrubOrphans (acc, percentagefunc); gnc_account_foreach_descendant(acc, (AccountCb)xaccAccountScrubOrphans, percentagefunc); }
void xaccAccountTreeScrubSplits (Account *account) { if (!account) return; xaccAccountScrubSplits (account); gnc_account_foreach_descendant(account, (AccountCb)xaccAccountScrubSplits, NULL); }
void xaccAccountTreeScrubOrphans (Account *acc) { if (!acc) return; xaccAccountScrubOrphans (acc); gnc_account_foreach_descendant(acc, (AccountCb)xaccAccountScrubOrphans, NULL); }
void xaccAccountTreeScrubCommodities (Account *acc) { if (!acc) return; xaccAccountTreeForEachTransaction (acc, scrub_trans_currency_helper, NULL); scrub_account_commodity_helper (acc, NULL); gnc_account_foreach_descendant (acc, scrub_account_commodity_helper, NULL); }
void on_finish (GtkAssistant *gtkassistant, hierarchy_data *data) { GncHierarchyAssistantFinishedCallback when_completed; gnc_commodity *com; Account * root; ENTER (" "); com = gnc_currency_edit_get_currency (GNC_CURRENCY_EDIT(data->currency_selector)); if (data->our_account_tree) { gnc_account_foreach_descendant (data->our_account_tree, (AccountCb)starting_balance_helper, data); } /* Set book options based on the user's choices */ if (data->new_book) finish_book_options_helper(data->optionwin, data->options); // delete before we suspend GUI events, and then muck with the model, // because the model doesn't seem to handle this correctly. if (data->initial_category) gtk_tree_row_reference_free(data->initial_category); delete_hierarchy_dialog (data); gnc_suspend_gui_refresh (); if (data->new_book) gtk_dialog_response(GTK_DIALOG(gnc_options_dialog_widget (data->optionwin)), GTK_RESPONSE_CANCEL); account_trees_merge(gnc_get_current_root_account(), data->our_account_tree); delete_our_account_tree (data); when_completed = data->when_completed; g_free(data); root = gnc_get_current_root_account(); xaccAccountSetCommodity(root, com); gnc_resume_gui_refresh (); if (when_completed) { (*when_completed)(); } LEAVE (" "); }
void dai_finish_cb(GnomeDruidPage *druid_page, GtkWidget *widget, gpointer user_data) { ABInitialInfo *info = user_data; Account *root; g_return_if_fail(info && info->gnc_hash); /* Commit the changes */ root = gnc_book_get_root_account(gnc_get_current_book()); gnc_account_foreach_descendant(root, (AccountCb) clear_kvp_acc_cb, NULL); g_hash_table_foreach(info->gnc_hash, (GHFunc) save_kvp_acc_cb, NULL); gtk_widget_destroy(info->window); }
void xaccAccountTreeScrubQuoteSources (Account *root, gnc_commodity_table *table) { gboolean new_style = FALSE; ENTER(" "); if (!root || !table) { LEAVE("Oops"); return; } gnc_commodity_table_foreach_commodity (table, check_quote_source, &new_style); move_quote_source(root, GINT_TO_POINTER(new_style)); gnc_account_foreach_descendant (root, move_quote_source, GINT_TO_POINTER(new_style)); LEAVE("Migration done"); }
void dai_match_page_prepare_cb(GnomeDruidPage *druid_page, GtkWidget *widget, gpointer user_data) { ABInitialInfo *info = user_data; Account *root; AccCbData data; g_return_if_fail(info && info->api); /* No way back */ gnome_druid_set_buttons_sensitive(GNOME_DRUID(info->druid), FALSE, TRUE, TRUE, TRUE); /* Do not run this twice */ if (info->match_page_prepared) return; else info->match_page_prepared = TRUE; /* Load aqbanking accounts */ #ifdef AQBANKING_VERSION_4_PLUS AB_Banking_OnlineInit(info->api, 0); #else AB_Banking_OnlineInit(info->api); #endif /* Determine current mapping */ root = gnc_book_get_root_account(gnc_get_current_book()); info->gnc_hash = g_hash_table_new(&g_direct_hash, &g_direct_equal); data.api = info->api; data.hash = info->gnc_hash; gnc_account_foreach_descendant( root, (AccountCb) hash_from_kvp_acc_cb, &data); /* Update the graphical representation */ update_account_list(info); }
/** * Executes a transaction query statement and loads the transactions and all * of the splits. * * @param be SQL backend * @param stmt SQL statement */ static void query_transactions( GncSqlBackend* be, GncSqlStatement* stmt ) { GncSqlResult* result; g_return_if_fail( be != NULL ); g_return_if_fail( stmt != NULL ); result = gnc_sql_execute_select_statement( be, stmt ); if ( result != NULL ) { GList* tx_list = NULL; GList* node; GncSqlRow* row; Transaction* tx; #if LOAD_TRANSACTIONS_AS_NEEDED GSList* bal_list = NULL; GSList* nextbal; Account* root = gnc_book_get_root_account( be->book ); qof_event_suspend(); xaccAccountBeginEdit( root ); // Save the start/ending balances (balance, cleared and reconciled) for // every account. gnc_account_foreach_descendant( gnc_book_get_root_account( be->primary_book ), save_account_balances, &bal_list ); #endif // Load the transactions row = gnc_sql_result_get_first_row( result ); while ( row != NULL ) { tx = load_single_tx( be, row ); if ( tx != NULL ) { tx_list = g_list_prepend( tx_list, tx ); } row = gnc_sql_result_get_next_row( result ); } gnc_sql_result_dispose( result ); // Load all splits and slots for the transactions if ( tx_list != NULL ) { gnc_sql_slots_load_for_list( be, tx_list ); load_splits_for_tx_list( be, tx_list ); } // Commit all of the transactions for ( node = tx_list; node != NULL; node = node->next ) { Transaction* pTx = GNC_TRANSACTION(node->data); xaccTransCommitEdit( pTx ); } g_list_free( tx_list ); #if LOAD_TRANSACTIONS_AS_NEEDED // Update the account balances based on the loaded splits. If the end // balance has changed, update the start balance so that the end // balance is the same as it was before the splits were loaded. // Repeat for cleared and reconciled balances. for ( nextbal = bal_list; nextbal != NULL; nextbal = nextbal->next ) { full_acct_balances_t* balns = (full_acct_balances_t*)nextbal->data; gnc_numeric* pnew_end_bal; gnc_numeric* pnew_end_c_bal; gnc_numeric* pnew_end_r_bal; gnc_numeric adj; g_object_get( balns->acc, "end-balance", &pnew_end_bal, "end-cleared-balance", &pnew_end_c_bal, "end-reconciled-balance", &pnew_end_r_bal, NULL ); if ( !gnc_numeric_eq( *pnew_end_bal, balns->end_bal ) ) { adj = gnc_numeric_sub( balns->end_bal, *pnew_end_bal, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD ); balns->start_bal = gnc_numeric_add( balns->start_bal, adj, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD ); g_object_set( balns->acc, "start-balance", &balns->start_bal, NULL ); } if ( !gnc_numeric_eq( *pnew_end_c_bal, balns->end_cleared_bal ) ) { adj = gnc_numeric_sub( balns->end_cleared_bal, *pnew_end_c_bal, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD ); balns->start_cleared_bal = gnc_numeric_add( balns->start_cleared_bal, adj, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD ); g_object_set( balns->acc, "start-cleared-balance", &balns->start_cleared_bal, NULL ); } if ( !gnc_numeric_eq( *pnew_end_r_bal, balns->end_reconciled_bal ) ) { adj = gnc_numeric_sub( balns->end_reconciled_bal, *pnew_end_r_bal, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD ); balns->start_reconciled_bal = gnc_numeric_add( balns->start_reconciled_bal, adj, GNC_DENOM_AUTO, GNC_HOW_DENOM_LCD ); g_object_set( balns->acc, "start-reconciled-balance", &balns->start_reconciled_bal, NULL ); } xaccAccountRecomputeBalance( balns->acc ); g_free( pnew_end_bal ); g_free( pnew_end_c_bal ); g_free( pnew_end_r_bal ); g_free( balns ); } if ( bal_list != NULL ) { g_slist_free( bal_list ); } xaccAccountCommitEdit( root ); qof_event_resume(); #endif } }
void GncSqlBackend::load (QofBook* book, QofBackendLoadType loadType) { Account* root; g_return_if_fail (book != NULL); ENTER ("sql_be=%p, book=%p", this, book); m_loading = TRUE; if (loadType == LOAD_TYPE_INITIAL_LOAD) { assert (m_book == nullptr); m_book = book; /* Load any initial stuff. Some of this needs to happen in a certain order */ for (auto type : fixed_load_order) { auto obe = m_backend_registry.get_object_backend(type); if (obe) { update_progress(); obe->load_all(this); } } for (auto type : business_fixed_load_order) { auto obe = m_backend_registry.get_object_backend(type); if (obe) { update_progress(); obe->load_all(this); } } root = gnc_book_get_root_account( book ); gnc_account_foreach_descendant(root, (AccountCb)xaccAccountBeginEdit, nullptr); m_backend_registry.load_remaining(this); gnc_account_foreach_descendant(root, (AccountCb)xaccAccountCommitEdit, nullptr); } else if (loadType == LOAD_TYPE_LOAD_ALL) { // Load all transactions auto obe = m_backend_registry.get_object_backend (GNC_ID_TRANS); obe->load_all (this); } m_loading = FALSE; std::for_each(m_postload_commodities.begin(), m_postload_commodities.end(), [](gnc_commodity* comm) { gnc_commodity_begin_edit(comm); gnc_commodity_commit_edit(comm); }); m_postload_commodities.empty(); /* Mark the sessoion as clean -- though it should never be marked * dirty with this backend */ qof_book_mark_session_saved (book); finish_progress(); LEAVE (""); }