mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 476114 - Goto register by date feature req
Adds ability to jump to arbitrary date. Finds first split whose posted date >= specified date, and jump to it.
This commit is contained in:
parent
befc4056ec
commit
c142416445
@ -232,6 +232,8 @@ static void gnc_plugin_page_register_cmd_delete_transaction (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_blank_transaction (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_goto_date (GtkAction* action,
|
||||
GncPluginPageRegister* page);
|
||||
static void gnc_plugin_page_register_cmd_duplicate_transaction (
|
||||
GtkAction* action, GncPluginPageRegister* plugin_page);
|
||||
static void gnc_plugin_page_register_cmd_reinitialize_transaction (
|
||||
@ -479,6 +481,11 @@ static GtkActionEntry gnc_plugin_page_register_actions [] =
|
||||
N_ ("Move to the blank transaction at the bottom of the register"),
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_blank_transaction)
|
||||
},
|
||||
{
|
||||
"GotoDateAction", "x-office-calendar", N_ ("_Go to Date"), "<primary>G",
|
||||
N_ ("Move to the the split at specified date"),
|
||||
G_CALLBACK (gnc_plugin_page_register_cmd_goto_date)
|
||||
},
|
||||
{
|
||||
"EditExchangeRateAction", NULL, N_ ("Edit E_xchange Rate"), NULL,
|
||||
N_ ("Edit the exchange rate for the current transaction"),
|
||||
@ -4688,6 +4695,47 @@ gnc_plugin_page_register_cmd_blank_transaction (GtkAction* action,
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_cmd_goto_date (GtkAction* action,
|
||||
GncPluginPageRegister* page)
|
||||
{
|
||||
GNCSplitReg* gsr;
|
||||
Query* query;
|
||||
time64 date = gnc_time (NULL);
|
||||
Split *split = NULL;
|
||||
|
||||
ENTER ("(action %p, plugin_page %p)", action, page);
|
||||
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
|
||||
|
||||
if (!gnc_dup_time64_dialog (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)),
|
||||
_("Go to Date"), _("Go to Date"), &date))
|
||||
{
|
||||
LEAVE ("goto_date cancelled");
|
||||
return;
|
||||
}
|
||||
|
||||
gsr = gnc_plugin_page_register_get_gsr (GNC_PLUGIN_PAGE (page));
|
||||
query = gnc_plugin_page_register_get_query (GNC_PLUGIN_PAGE (page));
|
||||
|
||||
for (GList *lp = qof_query_run (query); lp; lp = lp->next)
|
||||
{
|
||||
if (xaccTransGetDate (xaccSplitGetParent (lp->data)) >= date)
|
||||
{
|
||||
split = lp->data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Test for visibility of split */
|
||||
/* if (gnc_split_reg_clear_filter_for_split (gsr, split)) */
|
||||
/* gnc_plugin_page_register_clear_current_filter (GNC_PLUGIN_PAGE(page)); */
|
||||
|
||||
if (split)
|
||||
gnc_split_reg_jump_to_split (gsr, split);
|
||||
|
||||
LEAVE (" ");
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_plugin_page_register_cmd_duplicate_transaction (GtkAction* action,
|
||||
GncPluginPageRegister* plugin_page)
|
||||
|
@ -48,6 +48,7 @@
|
||||
<menuitem name="ActionLots" action="ActionsLotsAction"/>
|
||||
<separator name="ActionsSep4"/>
|
||||
<menuitem name="BlankTransaction" action="BlankTransactionAction"/>
|
||||
<menuitem name="GotoDate" action="GotoDateAction"/>
|
||||
<menuitem name="SplitTransaction" action="SplitTransactionAction"/>
|
||||
<menuitem name="EditExchangeRate" action="EditExchangeRateAction"/>
|
||||
<menuitem name="ScheduleTransaction" action="ScheduleTransactionAction"/>
|
||||
@ -106,6 +107,7 @@
|
||||
<menuitem name="JumpAssociateInvoice" action="JumpAssociatedInvoiceAction"/>
|
||||
<separator name="PopupSep5"/>
|
||||
<menuitem name="BlankTransaction" action="BlankTransactionAction"/>
|
||||
<menuitem name="GotoDate" action="GotoDateAction"/>
|
||||
<menuitem name="SplitTransaction" action="SplitTransactionAction"/>
|
||||
<menuitem name="EditExchangeRate" action="EditExchangeRateAction"/>
|
||||
<menuitem name="ScheduleTransaction" action="ScheduleTransactionAction"/>
|
||||
|
Loading…
Reference in New Issue
Block a user