mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-12 17:32:00 -05:00
Integration of the new Query subsystem, to replace the old Query
infrastructure. This also replaces the old "Find Transaction" dialog with the new gnome-search dialog. Registers, Reports, SXs, etc. all test out fine. Integration with SQL has been "done" (i.e. it compiles cleanly) but not "tested." Lots of the old code is still there, but #ifdef'ed out. That code will go away shortly. There is only one known loss-of-functionality: the query->xml-v1 converter was not re-implemented. The current intention is, if this functionality is required, to use the query->scm converter and then convert the scm->string and insert that into an XML document. Fix a Transaction Void bug. Fix a few bugs in test code. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6951 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
ba82fd2055
commit
0f0080c964
56 files changed
+4083
-2048
No files matched your search
@@ -1,3 +1,23 @@
|
||||
2002-06-05 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
Integration of the new Query subsystem, to replace the old Query
|
||||
infrastructure. This also replaces the old "Find Transaction"
|
||||
dialog with the new gnome-search dialog. Registers, Reports, SXs,
|
||||
etc. all test out fine. Integration with SQL has been "done"
|
||||
(i.e. it compiles cleanly) but not "tested." Lots of the old code
|
||||
is still there, but #ifdef'ed out. That code will go away
|
||||
shortly.
|
||||
|
||||
There is only one known loss-of-functionality: the query->xml-v1
|
||||
converter was not re-implemented. The current intention is, if
|
||||
this functionality is required, to use the query->scm converter
|
||||
and then convert the scm->string and insert that into an XML
|
||||
document.
|
||||
|
||||
Fix a Transaction Void bug.
|
||||
|
||||
Fix a few bugs in test code.
|
||||
|
||||
2002-06-04 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/gnc-mdi-utils.c (gnc_mdi_destroy): Work around a
|
||||
|
||||
@@ -70,7 +70,7 @@ static sixtp* commodity_restore_parser_new(void);
|
||||
static sixtp* generic_gnc_commodity_lookup_parser_new(void);
|
||||
|
||||
/* from Query-xml-parser-v1.c */
|
||||
static sixtp* query_server_parser_new (void);
|
||||
//static sixtp* query_server_parser_new (void);
|
||||
|
||||
/* from sixtp-kvp-parser.c */
|
||||
static sixtp* kvp_frame_parser_new(void);
|
||||
@@ -103,7 +103,7 @@ typedef struct {
|
||||
GNCPriceDB *pricedb;
|
||||
|
||||
/* The query */
|
||||
Query *query;
|
||||
// Query *query;
|
||||
|
||||
GNCParseErr error;
|
||||
} GNCParseStatus;
|
||||
@@ -167,12 +167,14 @@ gnc_parser_configure_for_input_version(GNCParseStatus *status, gint64 version)
|
||||
sixtp_add_sub_parser(status->gnc_parser, "ledger-data", ledger_data_pr);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* add <query-server> */
|
||||
{
|
||||
sixtp *query_server_pr = query_server_parser_new();
|
||||
g_return_val_if_fail(query_server_pr, FALSE);
|
||||
sixtp_add_sub_parser(status->gnc_parser, "query-server", query_server_pr);
|
||||
}
|
||||
#endif
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
@@ -256,9 +258,11 @@ gnc_parser_before_child_handler(gpointer data_for_children,
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(strcmp(child_tag, "query-server") == 0) {
|
||||
if(pstatus->query) return(FALSE);
|
||||
}
|
||||
#endif
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@@ -284,6 +288,7 @@ gnc_parser_after_child_handler(gpointer data_for_children,
|
||||
child_result->should_cleanup = FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(strcmp(child_tag, "query-server") == 0)
|
||||
{
|
||||
g_return_val_if_fail(child_result, FALSE);
|
||||
@@ -291,6 +296,7 @@ gnc_parser_after_child_handler(gpointer data_for_children,
|
||||
pstatus->query = (Query *) child_result->data;
|
||||
child_result->should_cleanup = FALSE;
|
||||
}
|
||||
#endif
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@@ -342,7 +348,7 @@ gncxml_setup_for_read (GNCParseStatus *global_parse_status)
|
||||
global_parse_status->gnc_parser = gnc_pr;
|
||||
global_parse_status->account_group = NULL;
|
||||
global_parse_status->pricedb = NULL;
|
||||
global_parse_status->query = NULL;
|
||||
// global_parse_status->query = NULL;
|
||||
global_parse_status->error = GNC_PARSE_ERR_NONE;
|
||||
|
||||
return top_level_pr;
|
||||
@@ -2179,6 +2185,8 @@ generic_gnc_commodity_lookup_parser_new(void)
|
||||
|
||||
return(top_level);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* <query-server> (parent <gnc-data>)
|
||||
|
||||
@@ -2698,6 +2706,8 @@ query_server_parser_new (void)
|
||||
|
||||
return(top_level);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/***********************************************************************/
|
||||
/****************************************************************************/
|
||||
/* <transaction> (parent <ledger-data>)
|
||||
|
||||
@@ -51,7 +51,7 @@ find_appropriate_node(xmlNodePtr node, Split *spl)
|
||||
{
|
||||
gnc_numeric *num = dom_tree_to_gnc_numeric(mark2);
|
||||
|
||||
if(gnc_numeric_equal(*num, xaccSplitGetValue(spl)))
|
||||
if(gnc_numeric_eq(*num, xaccSplitGetValue(spl)))
|
||||
{
|
||||
amount_good = TRUE;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
|
||||
{
|
||||
gnc_numeric *num = dom_tree_to_gnc_numeric(mark);
|
||||
|
||||
if(!gnc_numeric_equal(*num, xaccSplitGetValue(spl)))
|
||||
if(!gnc_numeric_eq(*num, xaccSplitGetValue(spl)))
|
||||
{
|
||||
printf("values differ\n");
|
||||
g_free(num);
|
||||
@@ -139,7 +139,7 @@ equals_node_val_vs_split_internal(xmlNodePtr node, Split* spl)
|
||||
{
|
||||
gnc_numeric *num = dom_tree_to_gnc_numeric(mark);
|
||||
|
||||
if(!gnc_numeric_equal(*num, xaccSplitGetAmount(spl)))
|
||||
if(!gnc_numeric_eq(*num, xaccSplitGetAmount(spl)))
|
||||
{
|
||||
printf("quantities differ\n");
|
||||
g_free(num);
|
||||
@@ -310,10 +310,11 @@ test_add_transaction(const char *tag, gpointer globaldata, gpointer data)
|
||||
xaccTransSetCurrency (trans, gdata->com);
|
||||
xaccTransCommitEdit (trans);
|
||||
|
||||
do_test_args(xaccTransEqual(gdata->trn, trans, TRUE, TRUE),
|
||||
"gnc_transaction_sixtp_parser_create",
|
||||
__FILE__, __LINE__,
|
||||
"%d", gdata->value);
|
||||
if (!do_test_args(xaccTransEqual(gdata->trn, trans, TRUE, TRUE),
|
||||
"gnc_transaction_sixtp_parser_create",
|
||||
__FILE__, __LINE__,
|
||||
"%d", gdata->value))
|
||||
return FALSE;
|
||||
|
||||
gdata->new_trn = trans;
|
||||
|
||||
@@ -325,7 +326,7 @@ test_transaction(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 20; i++)
|
||||
for(i = 0; i < 50; i++)
|
||||
{
|
||||
Transaction *ran_trn;
|
||||
xmlNodePtr test_node;
|
||||
|
||||
+459
-674
File diff suppressed because it is too large.
Load diff
@@ -45,7 +45,6 @@
|
||||
#define GNC_QUERY_H
|
||||
|
||||
#include "Query.h"
|
||||
#include "QueryP.h"
|
||||
#include "gnc-engine.h"
|
||||
|
||||
typedef struct _gnc_query sqlQuery;
|
||||
|
||||
@@ -8,7 +8,8 @@ GNC_TEST_DEPS := \
|
||||
--gnc-module-dir ${top_builddir}/src/engine \
|
||||
--gnc-module-dir ${top_builddir}/src/backend/file \
|
||||
--gnc-module-dir ${top_builddir}/src/backend/postgres \
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR}
|
||||
--guile-load-dir ${G_WRAP_MODULE_DIR} \
|
||||
--library-dir ${G_WRAP_LIB_DIR}
|
||||
|
||||
TESTS_ENVIRONMENT := \
|
||||
TEST_DB_SOCKET_DIR=`pwd`/gnc_test_db_sock \
|
||||
|
||||
@@ -568,6 +568,7 @@ test_trans_query (Transaction *trans, gpointer data)
|
||||
failure_args ("test num returned", __FILE__, __LINE__,
|
||||
"number of matching transactions %d not 1",
|
||||
g_list_length (list));
|
||||
g_list_free (list);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -577,6 +578,7 @@ test_trans_query (Transaction *trans, gpointer data)
|
||||
if (!xaccTransEqual (trans, list->data, TRUE, TRUE))
|
||||
{
|
||||
failure ("matching transaction is wrong");
|
||||
g_list_free (list);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -585,6 +587,7 @@ test_trans_query (Transaction *trans, gpointer data)
|
||||
xaccFreeQuery (q);
|
||||
gnc_session_destroy (session);
|
||||
g_free (filename);
|
||||
g_list_free (list);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -771,7 +771,7 @@ gnc_customer_search (GncCustomer *start, GNCBook *book)
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (type);
|
||||
gncQuerySetBook (q, book);
|
||||
|
||||
if (start) {
|
||||
|
||||
@@ -603,7 +603,7 @@ gnc_employee_search (GncEmployee *start, GNCBook *book)
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (type);
|
||||
gncQuerySetBook (q, book);
|
||||
|
||||
if (start) {
|
||||
|
||||
@@ -1523,17 +1523,27 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, GNCBook *book)
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (type);
|
||||
gncQuerySetBook (q, book);
|
||||
|
||||
/* If owner is supplied, limit all searches to invoices who's owner
|
||||
* (or parent) is the supplied owner! Show all invoices by this owner.
|
||||
* or end-owner is the supplied owner! Show all invoices by this
|
||||
* owner. If a Job is supplied, search for all invoices for that
|
||||
* job, but if a Customer is supplied, search for all invoices owned
|
||||
* by that Customer or any of that Customer's Jobs. In other words,
|
||||
* match on <supplied-owner's guid> == Invoice->Owner->GUID or
|
||||
* Invoice->owner->parentGUID.
|
||||
*/
|
||||
if (owner && gncOwnerGetGUID (owner)) {
|
||||
gncQueryAddGUIDMatch (q, g_slist_prepend
|
||||
(g_slist_prepend (NULL, QUERY_PARAM_GUID),
|
||||
INVOICE_OWNER),
|
||||
gncOwnerGetGUID (owner), QUERY_AND);
|
||||
gncOwnerGetGUID (owner), QUERY_OR);
|
||||
|
||||
gncQueryAddGUIDMatch (q, g_slist_prepend
|
||||
(g_slist_prepend (NULL, OWNER_PARENTG),
|
||||
INVOICE_OWNER),
|
||||
gncOwnerGetGUID (owner), QUERY_OR);
|
||||
|
||||
q2 = gncQueryCopy (q);
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ gnc_job_search (GncJob *start, GncOwner *owner, GNCBook *book)
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (type);
|
||||
gncQuerySetBook (q, book);
|
||||
|
||||
/* If owner is supplied, limit all searches to invoices who's owner
|
||||
|
||||
@@ -866,7 +866,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, GNCBook *book)
|
||||
}
|
||||
|
||||
/* Build the queries */
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (type);
|
||||
gncQuerySetBook (q, book);
|
||||
|
||||
/* If owner is supplied, limit all searches to orders who's owner
|
||||
@@ -875,7 +875,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, GNCBook *book)
|
||||
if (owner && gncOwnerGetGUID (owner)) {
|
||||
QueryNew *tmp, *q3;
|
||||
|
||||
q3 = gncQueryCreate ();
|
||||
q3 = gncQueryCreateFor (type);
|
||||
gncQueryAddGUIDMatch (q3, g_slist_prepend
|
||||
(g_slist_prepend (NULL, QUERY_PARAM_GUID),
|
||||
ORDER_OWNER),
|
||||
|
||||
@@ -269,7 +269,7 @@ void gnc_entry_ledger_set_default_order (GncEntryLedger *ledger,
|
||||
ledger->order = order;
|
||||
|
||||
if (!ledger->query && order) {
|
||||
ledger->query = gncQueryCreate ();
|
||||
ledger->query = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
|
||||
gncQuerySetBook (ledger->query, gncOrderGetBook (order));
|
||||
gncQueryAddGUIDMatch (ledger->query,
|
||||
g_slist_prepend (g_slist_prepend (NULL,
|
||||
@@ -302,11 +302,11 @@ static void create_invoice_query (GncEntryLedger *ledger)
|
||||
*/
|
||||
|
||||
/* Term 1 */
|
||||
ledger->query = gncQueryCreate ();
|
||||
ledger->query = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
|
||||
gncQuerySetBook (ledger->query, gncInvoiceGetBook (ledger->invoice));
|
||||
|
||||
/* Term 2 */
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
|
||||
gncQueryAddGUIDMatch (q,
|
||||
g_slist_prepend (g_slist_prepend (NULL,
|
||||
QUERY_PARAM_GUID),
|
||||
@@ -316,7 +316,7 @@ static void create_invoice_query (GncEntryLedger *ledger)
|
||||
/* Term 3 */
|
||||
if (ledger->type == GNCENTRY_INVOICE_ENTRY &&
|
||||
gncOwnerGetEndGUID (gncInvoiceGetOwner (ledger->invoice)) != NULL) {
|
||||
QueryNew *q2 = gncQueryCreate ();
|
||||
QueryNew *q2 = gncQueryCreateFor (GNC_ENTRY_MODULE_NAME);
|
||||
|
||||
/* entry_invoice->invoice_guid == NULL */
|
||||
gncQueryAddGUIDMatch (q2,
|
||||
|
||||
@@ -24,7 +24,7 @@ static GList *
|
||||
gnc_entry_ledger_get_entries (GncEntryLedger *ledger)
|
||||
{
|
||||
if (ledger->query)
|
||||
return gncQueryRun (ledger->query, GNC_ENTRY_MODULE_NAME);
|
||||
return gncQueryRun (ledger->query);
|
||||
|
||||
// g_warning ("No query to run?");
|
||||
return NULL;
|
||||
|
||||
@@ -463,4 +463,21 @@ xaccAccountFindTransByDesc(Account *account, const char *description);
|
||||
Split *
|
||||
xaccAccountFindSplitByDesc(Account *account, const char *description);
|
||||
|
||||
/* Account parameter names */
|
||||
|
||||
#define ACCOUNT_KVP "kvp"
|
||||
#define ACCOUNT_NAME_ "name"
|
||||
#define ACCOUNT_CODE_ "code"
|
||||
#define ACCOUNT_DESCRIPTION_ "desc"
|
||||
#define ACCOUNT_NOTES_ "notes"
|
||||
#define ACCOUNT_BALANCE_ "balance"
|
||||
#define ACCOUNT_CLEARED_BALANCE "cleared-balance"
|
||||
#define ACCOUNT_RECONCILED_BALANCE "reconciled-balance"
|
||||
#define ACCOUNT_TAX_RELATED "tax-related-p"
|
||||
|
||||
/* This is the type-override when you want to match all accounts. Used
|
||||
* in the gnome-search parameter list. Be carefule when you use this.
|
||||
*/
|
||||
#define ACCOUNT_MATCH_ALL_TYPE "account-match-all"
|
||||
|
||||
#endif /* XACC_ACCOUNT_H */
|
||||
+509
-50
@@ -34,19 +34,522 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gnc-book.h"
|
||||
#include "gnc-book-p.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-numeric.h"
|
||||
#include "AccountP.h"
|
||||
#include "BackendP.h"
|
||||
#include "Account.h"
|
||||
#include "GNCId.h"
|
||||
#include "GroupP.h"
|
||||
#include "QueryP.h"
|
||||
#include "Query.h"
|
||||
#include "Transaction.h"
|
||||
#include "TransactionP.h"
|
||||
|
||||
static short module = MOD_QUERY;
|
||||
|
||||
#if 1
|
||||
|
||||
static GSList *
|
||||
build_param_list_internal (const char *first, va_list rest)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
char const *param;
|
||||
|
||||
for (param = first; param; param = va_arg (rest, const char *))
|
||||
list = g_slist_prepend (list, (gpointer)param);
|
||||
|
||||
return (g_slist_reverse (list));
|
||||
}
|
||||
|
||||
static GSList *
|
||||
build_param_list (char const *param, ...)
|
||||
{
|
||||
GSList *param_list;
|
||||
va_list ap;
|
||||
|
||||
if (!param)
|
||||
return NULL;
|
||||
|
||||
va_start (ap, param);
|
||||
param_list = build_param_list_internal (param, ap);
|
||||
va_end (ap);
|
||||
|
||||
return param_list;
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* xaccQueryGetSplitsUniqueTrans
|
||||
* Get splits but no more than one from a given transaction.
|
||||
********************************************************************/
|
||||
|
||||
SplitList *
|
||||
xaccQueryGetSplitsUniqueTrans(Query *q)
|
||||
{
|
||||
GList * splits = xaccQueryGetSplits(q);
|
||||
GList * current;
|
||||
GList * result = NULL;
|
||||
GHashTable * trans_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
|
||||
for (current = splits; current; current = current->next)
|
||||
{
|
||||
Split *split = current->data;
|
||||
Transaction *trans = xaccSplitGetParent (split);
|
||||
|
||||
if (!g_hash_table_lookup (trans_hash, trans))
|
||||
{
|
||||
g_hash_table_insert (trans_hash, trans, trans);
|
||||
result = g_list_prepend (result, split);
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_destroy (trans_hash);
|
||||
|
||||
return g_list_reverse (result);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* xaccQueryGetTransactions
|
||||
* Get transactions matching the query terms, specifying whether
|
||||
* we require some or all splits to match
|
||||
********************************************************************/
|
||||
|
||||
static void
|
||||
query_match_all_filter_func(gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
Transaction * t = key;
|
||||
int num_matches = GPOINTER_TO_INT(value);
|
||||
GList ** matches = user_data;
|
||||
|
||||
if(num_matches == xaccTransCountSplits(t)) {
|
||||
*matches = g_list_prepend(*matches, t);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
query_match_any_filter_func(gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
Transaction * t = key;
|
||||
GList ** matches = user_data;
|
||||
*matches = g_list_prepend(*matches, t);
|
||||
}
|
||||
|
||||
TransList *
|
||||
xaccQueryGetTransactions (Query * q, query_txn_match_t runtype)
|
||||
{
|
||||
GList * splits = xaccQueryGetSplits(q);
|
||||
GList * current = NULL;
|
||||
GList * retval = NULL;
|
||||
GHashTable * trans_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
Transaction * trans = NULL;
|
||||
gpointer val = NULL;
|
||||
int count = 0;
|
||||
|
||||
/* iterate over matching splits, incrementing a match-count in
|
||||
* the hash table */
|
||||
for(current = splits; current; current=current->next) {
|
||||
trans = xaccSplitGetParent((Split *)(current->data));
|
||||
|
||||
/* don't waste time looking up unless we need the count
|
||||
* information */
|
||||
if(runtype == QUERY_TXN_MATCH_ALL) {
|
||||
val = g_hash_table_lookup(trans_hash, trans);
|
||||
count = GPOINTER_TO_INT(val);
|
||||
}
|
||||
g_hash_table_insert(trans_hash, trans, GINT_TO_POINTER(count + 1));
|
||||
}
|
||||
|
||||
/* now pick out the transactions that match */
|
||||
if(runtype == QUERY_TXN_MATCH_ALL) {
|
||||
g_hash_table_foreach(trans_hash, query_match_all_filter_func,
|
||||
&retval);
|
||||
}
|
||||
else {
|
||||
g_hash_table_foreach(trans_hash, query_match_any_filter_func,
|
||||
&retval);
|
||||
}
|
||||
|
||||
g_hash_table_destroy(trans_hash);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* match-adding API
|
||||
*******************************************************************/
|
||||
|
||||
void
|
||||
xaccQueryAddAccountMatch(Query *q, AccountList *acct_list,
|
||||
guid_match_t how, QueryOp op)
|
||||
{
|
||||
GList *list = NULL;
|
||||
|
||||
if (!q) return;
|
||||
for (; acct_list; acct_list = acct_list->next) {
|
||||
Account *acc = acct_list->data;
|
||||
const GUID *guid;
|
||||
|
||||
if (!acc) {
|
||||
PWARN ("acct_list has NULL account");
|
||||
continue;
|
||||
}
|
||||
|
||||
guid = xaccAccountGetGUID (acc);
|
||||
if (!guid) {
|
||||
PWARN ("acct returns NULL GUID");
|
||||
continue;
|
||||
}
|
||||
|
||||
list = g_list_prepend (list, (gpointer)guid);
|
||||
}
|
||||
xaccQueryAddAccountGUIDMatch (q, list, how, op);
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddAccountGUIDMatch(Query *q, AccountGUIDList *guid_list,
|
||||
guid_match_t how, QueryOp op)
|
||||
{
|
||||
QueryPredData_t pred_data;
|
||||
GSList *param_list = NULL;
|
||||
|
||||
if (!q) return;
|
||||
|
||||
pred_data = gncQueryGUIDPredicate (how, guid_list);
|
||||
if (!pred_data)
|
||||
return;
|
||||
|
||||
switch (how) {
|
||||
case GUID_MATCH_ANY:
|
||||
case GUID_MATCH_NONE:
|
||||
param_list = build_param_list (SPLIT_ACCOUNT, QUERY_PARAM_GUID, NULL);
|
||||
break;
|
||||
case GUID_MATCH_ALL:
|
||||
param_list = build_param_list (SPLIT_TRANS, TRANS_SPLITLIST,
|
||||
SPLIT_ACCOUNT_GUID, NULL);
|
||||
break;
|
||||
default:
|
||||
PERR ("Invalid match type: %d", how);
|
||||
}
|
||||
|
||||
gncQueryAddTerm (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddSingleAccountMatch(Query *q, Account *acc, QueryOp op)
|
||||
{
|
||||
GList *list;
|
||||
const GUID *guid;
|
||||
|
||||
if (!q || !acc)
|
||||
return;
|
||||
|
||||
guid = xaccAccountGetGUID (acc);
|
||||
g_return_if_fail (guid);
|
||||
|
||||
list = g_list_prepend (NULL, (gpointer)guid);
|
||||
xaccQueryAddAccountGUIDMatch (q, list, GUID_MATCH_ANY, op);
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddStringMatch (Query* q, const char *matchstring,
|
||||
int case_sens, int use_regexp, QueryOp op,
|
||||
const char * path, ...)
|
||||
{
|
||||
QueryPredData_t pred_data;
|
||||
GSList *param_list;
|
||||
va_list ap;
|
||||
|
||||
if (!path || !q)
|
||||
return;
|
||||
|
||||
pred_data = gncQueryStringPredicate (COMPARE_EQUAL, (char *)matchstring,
|
||||
(case_sens ? STRING_MATCH_NORMAL :
|
||||
STRING_MATCH_CASEINSENSITIVE),
|
||||
use_regexp);
|
||||
if (!pred_data)
|
||||
return;
|
||||
|
||||
va_start (ap, path);
|
||||
param_list = build_param_list_internal (path, ap);
|
||||
va_end (ap);
|
||||
|
||||
gncQueryAddTerm (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddNumericMatch (Query *q, gnc_numeric amount, numeric_match_t sign,
|
||||
query_compare_t how, QueryOp op,
|
||||
const char * path, ...)
|
||||
{
|
||||
QueryPredData_t pred_data;
|
||||
GSList *param_list;
|
||||
va_list ap;
|
||||
|
||||
if (!q || !path)
|
||||
return;
|
||||
|
||||
pred_data = gncQueryNumericPredicate (how, sign, amount);
|
||||
if (!pred_data)
|
||||
return;
|
||||
|
||||
va_start (ap, path);
|
||||
param_list = build_param_list_internal (path, ap);
|
||||
va_end (ap);
|
||||
|
||||
gncQueryAddTerm (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
/* The DateMatch queries match transactions whose posted date
|
||||
* is in a date range. If use_start is TRUE, then a matching
|
||||
* posted date will be greater than the start date. If
|
||||
* use_end is TRUE, then a match occurs for posted dates earlier
|
||||
* than the end date. If both flags are set, then *both*
|
||||
* conditions must hold ('and'). If neither flag is set, then
|
||||
* all transactions are matched.
|
||||
*/
|
||||
|
||||
void
|
||||
xaccQueryAddDateMatchTS (Query * q,
|
||||
int use_start, Timespec sts,
|
||||
int use_end, Timespec ets,
|
||||
QueryOp op)
|
||||
{
|
||||
Query *tmp_q = NULL;
|
||||
QueryPredData_t pred_data;
|
||||
GSList *param_list;
|
||||
|
||||
if (!q || (!use_start && !use_end))
|
||||
return;
|
||||
|
||||
tmp_q = gncQueryCreate ();
|
||||
|
||||
if (use_start) {
|
||||
pred_data = gncQueryDatePredicate (COMPARE_GTE, DATE_MATCH_NORMAL, sts);
|
||||
if (!pred_data) {
|
||||
gncQueryDestroy (tmp_q);
|
||||
return;
|
||||
}
|
||||
|
||||
param_list = build_param_list (SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
|
||||
gncQueryAddTerm (tmp_q, param_list, pred_data, QUERY_AND);
|
||||
}
|
||||
|
||||
if (use_end) {
|
||||
pred_data = gncQueryDatePredicate (COMPARE_LTE, DATE_MATCH_NORMAL, ets);
|
||||
if (!pred_data) {
|
||||
gncQueryDestroy (tmp_q);
|
||||
return;
|
||||
}
|
||||
|
||||
param_list = build_param_list (SPLIT_TRANS, TRANS_DATE_POSTED, NULL);
|
||||
gncQueryAddTerm (tmp_q, param_list, pred_data, QUERY_AND);
|
||||
}
|
||||
|
||||
gncQueryMergeInPlace (q, tmp_q, op);
|
||||
gncQueryDestroy (tmp_q);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* xaccQueryAddDateMatch
|
||||
* Add a date filter to an existing query.
|
||||
********************************************************************/
|
||||
|
||||
void
|
||||
xaccQueryAddDateMatch(Query * q,
|
||||
int use_start, int sday, int smonth, int syear,
|
||||
int use_end, int eday, int emonth, int eyear,
|
||||
QueryOp op)
|
||||
{
|
||||
/* gcc -O3 will auto-inline this function, avoiding a call overhead */
|
||||
xaccQueryAddDateMatchTS (q, use_start,
|
||||
gnc_dmy2timespec(sday, smonth, syear),
|
||||
use_end,
|
||||
gnc_dmy2timespec_end(eday, emonth, eyear),
|
||||
op);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* xaccQueryAddDateMatchTT
|
||||
* Add a date filter to an existing query.
|
||||
********************************************************************/
|
||||
|
||||
void
|
||||
xaccQueryAddDateMatchTT(Query * q,
|
||||
int use_start,
|
||||
time_t stt,
|
||||
int use_end,
|
||||
time_t ett,
|
||||
QueryOp op)
|
||||
{
|
||||
Timespec sts;
|
||||
Timespec ets;
|
||||
|
||||
sts.tv_sec = (long long)stt;
|
||||
sts.tv_nsec = 0;
|
||||
|
||||
ets.tv_sec = (long long)ett;
|
||||
ets.tv_nsec = 0;
|
||||
|
||||
/* gcc -O3 will auto-inline this function, avoiding a call overhead */
|
||||
xaccQueryAddDateMatchTS (q, use_start, sts,
|
||||
use_end, ets, op);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QueryOp op)
|
||||
{
|
||||
QueryPredData_t pred_data;
|
||||
GSList *param_list;
|
||||
char chars[6];
|
||||
int i = 0;
|
||||
|
||||
if (!q)
|
||||
return;
|
||||
|
||||
if (how & CLEARED_CLEARED)
|
||||
chars[i++] = CREC;
|
||||
if (how & CLEARED_RECONCILED)
|
||||
chars[i++] = YREC;
|
||||
if (how & CLEARED_FROZEN)
|
||||
chars[i++] = FREC;
|
||||
if (how & CLEARED_NO)
|
||||
chars[i++] = NREC;
|
||||
if (how & CLEARED_VOIDED)
|
||||
chars[i++] = VREC;
|
||||
chars[i] = '\0';
|
||||
|
||||
pred_data = gncQueryCharPredicate (CHAR_MATCH_ANY, chars);
|
||||
if (!pred_data)
|
||||
return;
|
||||
|
||||
param_list = build_param_list (SPLIT_RECONCILE, NULL);
|
||||
|
||||
gncQueryAddTerm (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||
GNCIdType id_type, QueryOp op)
|
||||
{
|
||||
GSList *param_list = NULL;
|
||||
|
||||
if (!q || !guid || !id_type)
|
||||
return;
|
||||
|
||||
if (!safe_strcmp (id_type, GNC_ID_SPLIT))
|
||||
param_list = build_param_list (QUERY_PARAM_GUID, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_TRANS))
|
||||
param_list = build_param_list (SPLIT_TRANS, QUERY_PARAM_GUID, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
|
||||
param_list = build_param_list (SPLIT_ACCOUNT, QUERY_PARAM_GUID, NULL);
|
||||
else
|
||||
PERR ("Invalid match type: %s", id_type);
|
||||
|
||||
gncQueryAddGUIDMatch (q, param_list, guid, op);
|
||||
}
|
||||
|
||||
void
|
||||
xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
|
||||
query_compare_t how, GNCIdType id_type,
|
||||
QueryOp op)
|
||||
{
|
||||
GSList *param_list = NULL;
|
||||
QueryPredData_t pred_data;
|
||||
|
||||
if (!q || !path || !value || !id_type)
|
||||
return;
|
||||
|
||||
pred_data = gncQueryKVPPredicate (how, path, value);
|
||||
if (!pred_data)
|
||||
return;
|
||||
|
||||
if (!safe_strcmp (id_type, GNC_ID_SPLIT))
|
||||
param_list = build_param_list (SPLIT_KVP, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_TRANS))
|
||||
param_list = build_param_list (SPLIT_TRANS, TRANS_KVP, NULL);
|
||||
else if (!safe_strcmp (id_type, GNC_ID_ACCOUNT))
|
||||
param_list = build_param_list (SPLIT_ACCOUNT, ACCOUNT_KVP, NULL);
|
||||
else
|
||||
PERR ("Invalid match type: %s", id_type);
|
||||
|
||||
gncQueryAddTerm (q, param_list, pred_data, op);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* xaccQueryGetEarliestDateFound
|
||||
*******************************************************************/
|
||||
|
||||
time_t
|
||||
xaccQueryGetEarliestDateFound(Query * q)
|
||||
{
|
||||
GList * spl;
|
||||
Split * sp;
|
||||
time_t earliest = LONG_MAX;
|
||||
|
||||
if (!q) return 0;
|
||||
spl = gncQueryLastRun (q);
|
||||
if (!spl) return 0;
|
||||
|
||||
for(; spl; spl=spl->next) {
|
||||
sp = spl->data;
|
||||
if(sp->parent->date_posted.tv_sec < earliest) {
|
||||
earliest = (time_t) sp->parent->date_posted.tv_sec;
|
||||
}
|
||||
}
|
||||
return earliest;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* xaccQueryGetLatestDateFound
|
||||
*******************************************************************/
|
||||
|
||||
time_t
|
||||
xaccQueryGetLatestDateFound(Query * q)
|
||||
{
|
||||
Split * sp;
|
||||
GList * spl;
|
||||
time_t latest = 0;
|
||||
|
||||
if(!q) return 0;
|
||||
spl = gncQueryLastRun (q);
|
||||
if(!spl) return 0;
|
||||
|
||||
for(; spl; spl=spl->next) {
|
||||
sp = spl->data;
|
||||
if(sp->parent->date_posted.tv_sec > latest) {
|
||||
latest = (time_t) sp->parent->date_posted.tv_sec;
|
||||
}
|
||||
}
|
||||
return latest;
|
||||
}
|
||||
|
||||
void
|
||||
xaccQuerySetSortOrder(Query *q, GList *p1, GList *p2, GList *p3)
|
||||
{
|
||||
GSList *l1 = NULL, *l2 = NULL, *l3 = NULL;
|
||||
GList *node;
|
||||
|
||||
for (node = p1; node; node = node->next)
|
||||
l1 = g_slist_prepend (l1, node->data);
|
||||
|
||||
for (node = p2; node; node = node->next)
|
||||
l2 = g_slist_prepend (l2, node->data);
|
||||
|
||||
for (node = p3; node; node = node->next)
|
||||
l3 = g_slist_prepend (l3, node->data);
|
||||
|
||||
if (l1) l1 = g_slist_reverse (l1);
|
||||
if (l2) l2 = g_slist_reverse (l2);
|
||||
if (l3) l3 = g_slist_reverse (l3);
|
||||
|
||||
if (p1) g_list_free (p1);
|
||||
if (p2) g_list_free (p2);
|
||||
if (p3) g_list_free (p3);
|
||||
|
||||
gncQuerySetSortOrder (q, l1, l2, l3);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* the Query makes a subset of all splits based on 3 things:
|
||||
* - an AND-OR tree of predicates which combine to make a
|
||||
* split filter
|
||||
@@ -3015,50 +3518,6 @@ DxaccQuerySetGroup(Query * q, AccountGroup *grp)
|
||||
xaccQuerySetBook (q, xaccGroupGetBook(grp));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* xaccQueryGetEarliestDateFound
|
||||
*******************************************************************/
|
||||
|
||||
time_t
|
||||
xaccQueryGetEarliestDateFound(Query * q)
|
||||
{
|
||||
GList * spl;
|
||||
Split * sp;
|
||||
time_t earliest = LONG_MAX;
|
||||
|
||||
if (!q) return 0;
|
||||
if (!q->split_list) return 0;
|
||||
|
||||
for(spl = q->split_list; spl; spl=spl->next) {
|
||||
sp = spl->data;
|
||||
if(sp->parent->date_posted.tv_sec < earliest) {
|
||||
earliest = (time_t) sp->parent->date_posted.tv_sec;
|
||||
}
|
||||
}
|
||||
return earliest;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* xaccQueryGetEarliestDateFound
|
||||
*******************************************************************/
|
||||
|
||||
time_t
|
||||
xaccQueryGetLatestDateFound(Query * q)
|
||||
{
|
||||
Split * sp;
|
||||
GList * spl;
|
||||
time_t latest = 0;
|
||||
|
||||
if(!q) return 0;
|
||||
if(!q->split_list) return 0;
|
||||
|
||||
for(spl = q->split_list; spl; spl=spl->next) {
|
||||
sp = spl->data;
|
||||
if(sp->parent->date_posted.tv_sec > latest) {
|
||||
latest = (time_t) sp->parent->date_posted.tv_sec;
|
||||
}
|
||||
}
|
||||
return latest;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/* ======================== END OF FILE ======================= */
|
||||
+182
-60
@@ -34,6 +34,186 @@
|
||||
#include "guid.h"
|
||||
#include "kvp_frame.h"
|
||||
|
||||
#if 1
|
||||
#include "QueryNew.h"
|
||||
#include "QueryCore.h"
|
||||
|
||||
/*
|
||||
* This function defines a compatibility API from the old Query API to
|
||||
* the new Query API. Note that it is not a 100% complete equivalent.
|
||||
* Many functions have a one-to-one mapping in the new API, but many
|
||||
* others do not.
|
||||
*/
|
||||
|
||||
typedef QueryNew Query;
|
||||
|
||||
#define xaccMallocQuery() gncQueryCreateFor(GNC_ID_SPLIT)
|
||||
#define xaccFreeQuery gncQueryDestroy
|
||||
#define xaccQueryCopy gncQueryCopy
|
||||
#define xaccQuerySetBook gncQuerySetBook
|
||||
|
||||
#define xaccQueryInvert gncQueryInvert
|
||||
#define xaccQueryMerge gncQueryMerge
|
||||
#define xaccQueryClear gncQueryClear
|
||||
|
||||
/* The xaccQueryHasTerms() routine returns the number of 'OR' terms in the query.
|
||||
* The xaccQueryNumTerms() routine returns the total number of terms in the query.
|
||||
*/
|
||||
|
||||
// void xaccQueryPurgeTerms(Query * q, pd_type_t type);
|
||||
// gboolean xaccQueryHasTermType(Query * q, pd_type_t type);
|
||||
#define xaccQueryHasTerms gncQueryHasTerms
|
||||
#define xaccQueryNumTerms gncQueryNumTerms
|
||||
// #define xaccQueryGetTerms gncQueryGetTerms
|
||||
|
||||
|
||||
#define xaccQuerySetSortIncreasing gncQuerySetSortIncreasing
|
||||
|
||||
#define xaccQuerySetMaxSplits gncQuerySetMaxResults
|
||||
#define xaccQueryGetMaxSplits gncQueryGetMaxResults
|
||||
|
||||
#define xaccQueryEqual gncQueryEqual
|
||||
|
||||
typedef enum {
|
||||
QUERY_TXN_MATCH_ALL=1, /* match all accounts */
|
||||
QUERY_TXN_MATCH_ANY=2 /* match any account */
|
||||
} query_txn_match_t;
|
||||
|
||||
/* After the query has been set up, call one of these to run the query.
|
||||
*
|
||||
* The xaccQueryGetSplits() routine returns all splits matching the
|
||||
* query. Any given split will appear at most once in the result;
|
||||
* however, several splits from one transaction may appear in the list.
|
||||
* The caller MUST NOT change the GList.
|
||||
*
|
||||
* The xaccQueryGetSplitsUniqueTrans() routine returns splits matching
|
||||
* the query, but only one matching split per transaction will be
|
||||
* returned. In other words, any given transaction will be
|
||||
* represented at most once in the returned list. The caller must
|
||||
* free the GList.
|
||||
*
|
||||
* The xaccQueryGetTransactions() routine returns a list of
|
||||
* transactions that match the query. The GList must be freed by
|
||||
* the caller. The query_run_t argument is used to provide account
|
||||
* matching in the following way:
|
||||
*
|
||||
* query_txn_match_t describes how to match accounts when querying
|
||||
* for transactions with xaccQueryGetTransactions().
|
||||
* What is the difference between 'ANY' and 'ALL', you
|
||||
* may ask? First, let us recall that a transaction consists
|
||||
* of splits, and each split belongs to exactly one account.
|
||||
* Specifying "MATCH_ALL" means that *every* account that
|
||||
* shows up in the query must also show up in some split in
|
||||
* the transaction (in order for that transaction to be
|
||||
* selected). By contrast, specifying 'ANY' means that
|
||||
* any account in the query must show up in some split
|
||||
* in the transaction (in order for the transaction to
|
||||
* be selected). Thus, 'ANY' acts as a boolean-OR when
|
||||
* matching accounts, whereas 'AND' acts as a boolean-AND
|
||||
* for matching accounts. Whew. Got that?
|
||||
*/
|
||||
#define xaccQueryGetSplits gncQueryRun
|
||||
SplitList * xaccQueryGetSplitsUniqueTrans(Query *q);
|
||||
TransList * xaccQueryGetTransactions(Query * q, query_txn_match_t type);
|
||||
|
||||
/*******************************************************************
|
||||
* match-adding API
|
||||
*******************************************************************/
|
||||
|
||||
void xaccQueryAddAccountMatch(Query *, AccountList *,
|
||||
guid_match_t how, QueryOp op);
|
||||
|
||||
void xaccQueryAddAccountGUIDMatch(Query *, AccountGUIDList *,
|
||||
guid_match_t, QueryOp);
|
||||
|
||||
void xaccQueryAddSingleAccountMatch(Query *, Account *, QueryOp);
|
||||
|
||||
void xaccQueryAddStringMatch (Query* q, const char *matchstring,
|
||||
int case_sens, int use_regexp, QueryOp op,
|
||||
const char * path, ...);
|
||||
|
||||
#define xaccQueryAddDescriptionMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
|
||||
TRANS_DESCRIPTION, NULL)
|
||||
#define xaccQueryAddNumberMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_TRANS, \
|
||||
TRANS_NUM, NULL)
|
||||
#define xaccQueryAddActionMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_ACTION, \
|
||||
NULL)
|
||||
#define xaccQueryAddMemoMatch(q,m,c,r,o) \
|
||||
xaccQueryAddStringMatch ((q), (m), (c), (r), (o), SPLIT_MEMO, \
|
||||
NULL)
|
||||
|
||||
void xaccQueryAddNumericMatch (Query *q, gnc_numeric amount,
|
||||
numeric_match_t sign, query_compare_t how,
|
||||
QueryOp op, const char * path, ...);
|
||||
|
||||
#define xaccQueryAddValueMatch(q,amt,sgn,how,op) \
|
||||
xaccQueryAddNumericMatch ((q), (amt), (sgn), (how), (op), \
|
||||
SPLIT_VALUE, NULL)
|
||||
|
||||
#define xaccQueryAddSharePriceMatch(q,amt,how,op) \
|
||||
xaccQueryAddNumericMatch ((q), (amt), NUMERIC_MATCH_ANY, (how), (op), \
|
||||
SPLIT_SHARE_PRICE, NULL)
|
||||
|
||||
#define xaccQueryAddSharesMatch(q,amt,how,op) \
|
||||
xaccQueryAddNumericMatch ((q), (amt), NUMERIC_MATCH_ANY, (how), (op), \
|
||||
SPLIT_AMOUNT, NULL)
|
||||
|
||||
#define xaccQueryAddBalanceMatch(q,bal,op) \
|
||||
xaccQueryAddNumericMatch ((q), gnc_numeric_zero(), NUMERIC_MATCH_ANY, \
|
||||
((bal) ? COMPARE_EQUAL : COMPARE_NEQ), (op), \
|
||||
SPLIT_TRANS, TRANS_IMBALANCE, NULL)
|
||||
|
||||
/* The DateMatch queries match transactions whose posted date
|
||||
* is in a date range. If use_start is TRUE, then a matching
|
||||
* posted date will be greater than the start date. If
|
||||
* use_end is TRUE, then a match occurs for posted dates earlier
|
||||
* than the end date. If both flags are set, then *both*
|
||||
* conditions must hold ('and'). If neither flag is set, then
|
||||
* all transactions are matched.
|
||||
*/
|
||||
|
||||
void xaccQueryAddDateMatch(Query * q,
|
||||
int use_start, int sday, int smonth, int syear,
|
||||
int use_end, int eday, int emonth, int eyear,
|
||||
QueryOp op);
|
||||
void xaccQueryAddDateMatchTS(Query * q,
|
||||
int use_start, Timespec sts,
|
||||
int use_end, Timespec ets,
|
||||
QueryOp op);
|
||||
void xaccQueryAddDateMatchTT(Query * q,
|
||||
int use_start, time_t stt,
|
||||
int use_end, time_t ett,
|
||||
QueryOp op);
|
||||
typedef enum {
|
||||
CLEARED_NO = 1 << 0,
|
||||
CLEARED_CLEARED = 1 << 1,
|
||||
CLEARED_RECONCILED = 1 << 2,
|
||||
CLEARED_FROZEN = 1 << 3,
|
||||
CLEARED_VOIDED = 1 << 4
|
||||
} cleared_match_t;
|
||||
|
||||
void xaccQueryAddClearedMatch(Query * q, cleared_match_t how, QueryOp op);
|
||||
void xaccQueryAddGUIDMatch(Query * q, const GUID *guid,
|
||||
GNCIdType id_type, QueryOp op);
|
||||
|
||||
/* given kvp value is on right side of comparison */
|
||||
void xaccQueryAddKVPMatch(Query *q, GSList *path, const kvp_value *value,
|
||||
query_compare_t how, GNCIdType id_type,
|
||||
QueryOp op);
|
||||
|
||||
void xaccQuerySetSortOrder(Query *q, GList *p1, GList *p2, GList *p3);
|
||||
|
||||
/*******************************************************************
|
||||
* compatibility interface with old Query API
|
||||
*******************************************************************/
|
||||
time_t xaccQueryGetEarliestDateFound(Query * q);
|
||||
time_t xaccQueryGetLatestDateFound(Query * q);
|
||||
|
||||
#else
|
||||
|
||||
typedef struct query_s Query;
|
||||
|
||||
/* Protect us if QueryNew.h is included first */
|
||||
@@ -161,70 +341,11 @@ typedef enum {
|
||||
} query_run_t;
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* basic Query API
|
||||
*******************************************************************/
|
||||
|
||||
Query * xaccMallocQuery(void);
|
||||
void xaccFreeQuery(Query *);
|
||||
Query * xaccQueryCopy(Query *q);
|
||||
void xaccQuerySetBook(Query * q, GNCBook *);
|
||||
void DxaccQuerySetGroup(Query * q, AccountGroup *); /* depricated */
|
||||
|
||||
Query * xaccQueryInvert(Query * q1);
|
||||
Query * xaccQueryMerge(Query * q1, Query * q2, QueryOp op);
|
||||
void xaccQueryClear(Query * q);
|
||||
|
||||
/* The xaccQueryHasTerms() routine returns the number of 'OR' terms in the query.
|
||||
* The xaccQueryNumTerms() routine returns the total number of terms in the query.
|
||||
*/
|
||||
|
||||
void xaccQueryPurgeTerms(Query * q, pd_type_t type);
|
||||
int xaccQueryHasTerms(Query * q);
|
||||
gboolean xaccQueryHasTermType(Query * q, pd_type_t type);
|
||||
GList * xaccQueryGetTerms(Query * q);
|
||||
int xaccQueryNumTerms(Query * q);
|
||||
|
||||
|
||||
/* After the query has been set up, call one of these to run the query.
|
||||
*
|
||||
* The xaccQueryGetSplits() routine returns all splits matching the
|
||||
* query. Any given split will appear at most once in the result;
|
||||
* however, several splits from one transaction may appear in the list.
|
||||
*
|
||||
* The xaccQueryGetSplitsUniqueTrans() routine returns splits matching
|
||||
* the query, but only one matching split per transaction will be
|
||||
* returned. In other words, any given transaction will be
|
||||
* represented at most once in the returned list.
|
||||
*
|
||||
* The xaccQueryGetTransactions() routine returns a list of
|
||||
* transactions that match the query. The query_run_t
|
||||
* argument is used to provide account matching in the
|
||||
* following way:
|
||||
*
|
||||
* query_run_t describes how to match accounts when querying
|
||||
* for transactions with xaccQueryGetTransactions().
|
||||
* What is the difference between 'ANY' and 'ALL', you
|
||||
* may ask? First, let us recall that a transaction consists
|
||||
* of splits, and each split belongs to exactly one account.
|
||||
* Specifying "MATCH_ALL" means that *every* account that
|
||||
* shows up in the query must also show up in some split in
|
||||
* the transaction (in order for that transaction to be
|
||||
* selected). By contrast, specifying 'ANY' means that
|
||||
* any account in the query must show up in some split
|
||||
* in the transaction (in order for the transaction to
|
||||
* be selected). Thus, 'ANY' acts as a boolean-OR when
|
||||
* matching accounts, whereas 'AND' acts as a boolean-AND
|
||||
* for matching accounts. Whew. Got that?
|
||||
*/
|
||||
SplitList * xaccQueryGetSplits(Query * q);
|
||||
SplitList * xaccQueryGetSplitsUniqueTrans(Query *q);
|
||||
TransList * xaccQueryGetTransactions(Query * q, query_run_t type);
|
||||
|
||||
/* compare two queries for equality. this is a simplistic
|
||||
* implementation -- logical equivalences between different
|
||||
* and/or trees are ignored. */
|
||||
gboolean xaccQueryEqual(Query *q1, Query *q2);
|
||||
gboolean gncQueryEqual(Query *q1, Query *q2);
|
||||
|
||||
/* handy for debugging */
|
||||
void xaccQueryPrint(Query *q);
|
||||
@@ -326,5 +447,6 @@ int xaccQueryGetMaxSplits(Query * q);
|
||||
time_t xaccQueryGetEarliestDateFound(Query * q);
|
||||
time_t xaccQueryGetLatestDateFound(Query * q);
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
#endif
|
||||
+198
-78
@@ -6,96 +6,87 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <glib.h>
|
||||
#include <regex.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gnc-engine-util.h"
|
||||
#include "QueryCoreP.h"
|
||||
#include "QueryNew.h"
|
||||
|
||||
static short module = MOD_QUERY;
|
||||
|
||||
/* Core Type Predicate definitions */
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
string_match_t options;
|
||||
gboolean is_regex;
|
||||
char * matchstring;
|
||||
regex_t compiled;
|
||||
} query_string_def, *query_string_t;
|
||||
/* A function to destroy a query predicate's pdata */
|
||||
typedef void (*QueryPredDataFree) (QueryPredData_t pdata);
|
||||
|
||||
/* A function to copy a query's predicate data */
|
||||
typedef QueryPredData_t (*QueryPredicateCopy) (QueryPredData_t pdata);
|
||||
|
||||
/* A function to take the object, apply the get_fcn, and return
|
||||
* a printable string. Note that this QueryAccess function should
|
||||
* be returning a type equal to this core object type.
|
||||
*
|
||||
* Note that this string MUST be freed by the caller.
|
||||
*/
|
||||
typedef char * (*QueryToString) (gpointer object, QueryAccess get_fcn);
|
||||
|
||||
/* A function to test for equality of predicate data */
|
||||
typedef gboolean (*QueryPredicateEqual) (QueryPredData_t p1,
|
||||
QueryPredData_t p2);
|
||||
|
||||
/* This function registers a new Core Object with the QueryNew
|
||||
* subsystem. It maps the "core_name" object to the given
|
||||
* query_predicate, predicate_copy, and predicate_data_free functions.
|
||||
*/
|
||||
static void gncQueryRegisterCoreObject (char const *type_name,
|
||||
QueryPredicate pred,
|
||||
QueryCompare comp,
|
||||
QueryPredicateCopy copy,
|
||||
QueryPredDataFree pd_free,
|
||||
QueryToString to_string,
|
||||
QueryPredicateEqual pred_equal);
|
||||
/* An example:
|
||||
*
|
||||
* gncQueryRegisterCoreObject (QUERYCORE_STRING, string_match_predicate,
|
||||
* string_compare_fcn, string_free_pdata,
|
||||
* string_print_fcn, pred_equal_fcn);
|
||||
*/
|
||||
|
||||
static QueryPredicateCopy gncQueryCoreGetCopy (char const *type);
|
||||
static QueryPredDataFree gncQueryCoreGetPredFree (char const *type);
|
||||
|
||||
/* Core Type Predicate helpers */
|
||||
typedef const char * (*query_string_getter) (gpointer);
|
||||
static const char * query_string_type = QUERYCORE_STRING;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
date_match_t options;
|
||||
Timespec date;
|
||||
} query_date_def, *query_date_t;
|
||||
typedef Timespec (*query_date_getter) (gpointer);
|
||||
static const char * query_date_type = QUERYCORE_DATE;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
numeric_match_t options;
|
||||
gnc_numeric amount;
|
||||
} query_numeric_def, *query_numeric_t;
|
||||
typedef gnc_numeric (*query_numeric_getter) (gpointer);
|
||||
static const char * query_numeric_type = QUERYCORE_NUMERIC;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
guid_match_t options;
|
||||
GList * guids;
|
||||
} query_guid_def, *query_guid_t;
|
||||
typedef const GUID * (*query_guid_getter) (gpointer);
|
||||
static const char * query_guid_type = QUERYCORE_GUID;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
gint64 val;
|
||||
} query_int64_def, *query_int64_t;
|
||||
typedef gint64 (*query_int64_getter) (gpointer);
|
||||
static const char * query_int64_type = QUERYCORE_INT64;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
double val;
|
||||
} query_double_def, *query_double_t;
|
||||
typedef double (*query_double_getter) (gpointer);
|
||||
static const char * query_double_type = QUERYCORE_DOUBLE;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
gboolean val;
|
||||
} query_boolean_def, *query_boolean_t;
|
||||
typedef gboolean (*query_boolean_getter) (gpointer);
|
||||
static const char * query_boolean_type = QUERYCORE_BOOLEAN;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
char_match_t options;
|
||||
char * char_list;
|
||||
} query_char_def, *query_char_t;
|
||||
typedef char (*query_char_getter) (gpointer);
|
||||
static const char * query_char_type = QUERYCORE_CHAR;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
GSList * path;
|
||||
kvp_value * value;
|
||||
} query_kvp_def, *query_kvp_t;
|
||||
typedef kvp_frame * (*query_kvp_getter) (gpointer);
|
||||
static const char * query_kvp_type = QUERYCORE_KVP;
|
||||
|
||||
/* Tables for predicate storage and lookup */
|
||||
static gboolean initialized = FALSE;
|
||||
static GHashTable *predTable = NULL;
|
||||
static GHashTable *cmpTable = NULL;
|
||||
static GHashTable *copyTable = NULL;
|
||||
static GHashTable *freeTable = NULL;
|
||||
static GHashTable *toStringTable = NULL;
|
||||
static GHashTable *predEqualTable = NULL;
|
||||
|
||||
#define COMPARE_ERROR -3
|
||||
#define PREDICATE_ERROR -2
|
||||
@@ -198,6 +189,16 @@ static QueryPredData_t string_copy_predicate (QueryPredData_t pd)
|
||||
pdata->is_regex);
|
||||
}
|
||||
|
||||
static gboolean string_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_string_t pd1 = (query_string_t) p1;
|
||||
query_string_t pd2 = (query_string_t) p2;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
if (pd1->is_regex != pd2->is_regex) return FALSE;
|
||||
return (safe_strcmp (pd1->matchstring, pd2->matchstring) == 0);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryStringPredicate (query_compare_t how,
|
||||
char *str, string_match_t options,
|
||||
gboolean is_regex)
|
||||
@@ -318,6 +319,15 @@ static QueryPredData_t date_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryDatePredicate (pd->how, pdata->options, pdata->date);
|
||||
}
|
||||
|
||||
static gboolean date_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_date_t pd1 = (query_date_t) p1;
|
||||
query_date_t pd2 = (query_date_t) p2;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
return timespec_equal (&(pd1->date), &(pd2->date));
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryDatePredicate (query_compare_t how,
|
||||
date_match_t options, Timespec date)
|
||||
{
|
||||
@@ -421,6 +431,15 @@ static QueryPredData_t numeric_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryNumericPredicate (pd->how, pdata->options, pdata->amount);
|
||||
}
|
||||
|
||||
static gboolean numeric_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_numeric_t pd1 = (query_numeric_t) p1;
|
||||
query_numeric_t pd2 = (query_numeric_t) p2;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
return gnc_numeric_equal (pd1->amount, pd2->amount);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryNumericPredicate (query_compare_t how,
|
||||
numeric_match_t options,
|
||||
gnc_numeric value)
|
||||
@@ -535,12 +554,27 @@ static QueryPredData_t guid_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryGUIDPredicate (pdata->options, pdata->guids);
|
||||
}
|
||||
|
||||
static gboolean guid_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_guid_t pd1 = (query_guid_t) p1;
|
||||
query_guid_t pd2 = (query_guid_t) p2;
|
||||
GList *l1 = pd1->guids, *l2 = pd2->guids;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
if (g_list_length (l1) != g_list_length (l2)) return FALSE;
|
||||
for ( ; l1 ; l1 = l1->next, l2 = l2->next)
|
||||
if (!guid_equal (l1->data, l2->data))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryGUIDPredicate (guid_match_t options, GList *guids)
|
||||
{
|
||||
query_guid_t pdata;
|
||||
GList *node;
|
||||
|
||||
pdata = g_new0 (query_guid_def, 1);
|
||||
pdata->pd.how = COMPARE_EQUAL;
|
||||
pdata->pd.type_name = query_guid_type;
|
||||
pdata->options = options;
|
||||
pdata->guids = g_list_copy (guids);
|
||||
@@ -611,6 +645,14 @@ static QueryPredData_t int64_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryInt64Predicate (pd->how, pdata->val);
|
||||
}
|
||||
|
||||
static gboolean int64_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_int64_t pd1 = (query_int64_t) p1;
|
||||
query_int64_t pd2 = (query_int64_t) p2;
|
||||
|
||||
return (pd1->val == pd2->val);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryInt64Predicate (query_compare_t how, gint64 val)
|
||||
{
|
||||
query_int64_t pdata = g_new0 (query_int64_def, 1);
|
||||
@@ -686,6 +728,14 @@ static QueryPredData_t double_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryDoublePredicate (pd->how, pdata->val);
|
||||
}
|
||||
|
||||
static gboolean double_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_double_t pd1 = (query_double_t) p1;
|
||||
query_double_t pd2 = (query_double_t) p2;
|
||||
|
||||
return (pd1->val == pd2->val);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryDoublePredicate (query_compare_t how, double val)
|
||||
{
|
||||
query_double_t pdata = g_new0 (query_double_def, 1);
|
||||
@@ -751,6 +801,14 @@ static QueryPredData_t boolean_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryBooleanPredicate (pd->how, pdata->val);
|
||||
}
|
||||
|
||||
static gboolean boolean_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_boolean_t pd1 = (query_boolean_t) p1;
|
||||
query_boolean_t pd2 = (query_boolean_t) p2;
|
||||
|
||||
return (pd1->val == pd2->val);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryBooleanPredicate (query_compare_t how, gboolean val)
|
||||
{
|
||||
query_boolean_t pdata;
|
||||
@@ -820,12 +878,22 @@ static QueryPredData_t char_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryCharPredicate (pdata->options, pdata->char_list);
|
||||
}
|
||||
|
||||
static gboolean char_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_char_t pd1 = (query_char_t) p1;
|
||||
query_char_t pd2 = (query_char_t) p2;
|
||||
|
||||
if (pd1->options != pd2->options) return FALSE;
|
||||
return (safe_strcmp (pd1->char_list, pd2->char_list) == 0);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryCharPredicate (char_match_t options, const char *chars)
|
||||
{
|
||||
query_char_t pdata;
|
||||
g_return_val_if_fail (chars, NULL);
|
||||
pdata = g_new0 (query_char_def, 1);
|
||||
pdata->pd.type_name = query_char_type;
|
||||
pdata->pd.how = COMPARE_EQUAL;
|
||||
pdata->options = options;
|
||||
pdata->char_list = g_strdup (chars);
|
||||
return ((QueryPredData_t)pdata);
|
||||
@@ -905,6 +973,25 @@ static QueryPredData_t kvp_copy_predicate (QueryPredData_t pd)
|
||||
return gncQueryKVPPredicate (pd->how, pdata->path, pdata->value);
|
||||
}
|
||||
|
||||
static gboolean kvp_predicate_equal (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
query_kvp_t pd1 = (query_kvp_t) p1;
|
||||
query_kvp_t pd2 = (query_kvp_t) p2;
|
||||
GSList *n1, *n2;
|
||||
|
||||
n1 = pd1->path;
|
||||
n2 = pd2->path;
|
||||
|
||||
for ( ; n1 && n2; n1 = n1->next, n2 = n2->next)
|
||||
if (safe_strcmp (n1->data, n2->data) != 0)
|
||||
return FALSE;
|
||||
|
||||
if (n1 || n2)
|
||||
return FALSE;
|
||||
|
||||
return (kvp_value_compare (pd1->value, pd2->value) == 0);
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryKVPPredicate (query_compare_t how,
|
||||
GSList *path, const kvp_value *value)
|
||||
{
|
||||
@@ -936,27 +1023,37 @@ static void init_tables (void)
|
||||
QueryPredicateCopy copy;
|
||||
QueryPredDataFree pd_free;
|
||||
QueryToString toString;
|
||||
QueryPredicateEqual pred_equal;
|
||||
} knownTypes[] = {
|
||||
{ QUERYCORE_STRING, string_match_predicate, string_compare_func,
|
||||
string_copy_predicate, string_free_pdata, string_to_string },
|
||||
string_copy_predicate, string_free_pdata, string_to_string,
|
||||
string_predicate_equal },
|
||||
{ QUERYCORE_DATE, date_match_predicate, date_compare_func,
|
||||
date_copy_predicate, date_free_pdata, date_to_string },
|
||||
date_copy_predicate, date_free_pdata, date_to_string,
|
||||
date_predicate_equal },
|
||||
{ QUERYCORE_DEBCRED, numeric_match_predicate, numeric_compare_func,
|
||||
numeric_copy_predicate, numeric_free_pdata, debcred_to_string },
|
||||
numeric_copy_predicate, numeric_free_pdata, debcred_to_string,
|
||||
numeric_predicate_equal },
|
||||
{ QUERYCORE_NUMERIC, numeric_match_predicate, numeric_compare_func,
|
||||
numeric_copy_predicate, numeric_free_pdata, numeric_to_string },
|
||||
numeric_copy_predicate, numeric_free_pdata, numeric_to_string,
|
||||
numeric_predicate_equal },
|
||||
{ QUERYCORE_GUID, guid_match_predicate, NULL,
|
||||
guid_copy_predicate, guid_free_pdata, NULL },
|
||||
guid_copy_predicate, guid_free_pdata, NULL,
|
||||
guid_predicate_equal },
|
||||
{ QUERYCORE_INT64, int64_match_predicate, int64_compare_func,
|
||||
int64_copy_predicate, int64_free_pdata, int64_to_string },
|
||||
int64_copy_predicate, int64_free_pdata, int64_to_string,
|
||||
int64_predicate_equal },
|
||||
{ QUERYCORE_DOUBLE, double_match_predicate, double_compare_func,
|
||||
double_copy_predicate, double_free_pdata, double_to_string },
|
||||
double_copy_predicate, double_free_pdata, double_to_string,
|
||||
double_predicate_equal },
|
||||
{ QUERYCORE_BOOLEAN, boolean_match_predicate, boolean_compare_func,
|
||||
boolean_copy_predicate, boolean_free_pdata, boolean_to_string },
|
||||
boolean_copy_predicate, boolean_free_pdata, boolean_to_string,
|
||||
boolean_predicate_equal },
|
||||
{ QUERYCORE_CHAR, char_match_predicate, char_compare_func,
|
||||
char_copy_predicate, char_free_pdata, char_to_string },
|
||||
char_copy_predicate, char_free_pdata, char_to_string,
|
||||
char_predicate_equal },
|
||||
{ QUERYCORE_KVP, kvp_match_predicate, NULL, kvp_copy_predicate,
|
||||
kvp_free_pdata, NULL },
|
||||
kvp_free_pdata, NULL, kvp_predicate_equal },
|
||||
};
|
||||
|
||||
/* Register the known data types */
|
||||
@@ -966,19 +1063,30 @@ static void init_tables (void)
|
||||
knownTypes[i].comp,
|
||||
knownTypes[i].copy,
|
||||
knownTypes[i].pd_free,
|
||||
knownTypes[i].toString);
|
||||
knownTypes[i].toString,
|
||||
knownTypes[i].pred_equal);
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* PUBLISHED API FUNCTIONS */
|
||||
static QueryPredicateCopy gncQueryCoreGetCopy (char const *type)
|
||||
{
|
||||
g_return_val_if_fail (type, NULL);
|
||||
return g_hash_table_lookup (copyTable, type);
|
||||
}
|
||||
|
||||
void gncQueryRegisterCoreObject (char const *core_name,
|
||||
static QueryPredDataFree gncQueryCoreGetPredFree (char const *type)
|
||||
{
|
||||
g_return_val_if_fail (type, NULL);
|
||||
return g_hash_table_lookup (freeTable, type);
|
||||
}
|
||||
|
||||
static void gncQueryRegisterCoreObject (char const *core_name,
|
||||
QueryPredicate pred,
|
||||
QueryCompare comp,
|
||||
QueryPredicateCopy copy,
|
||||
QueryPredDataFree pd_free,
|
||||
QueryToString toString)
|
||||
QueryToString toString,
|
||||
QueryPredicateEqual pred_equal)
|
||||
{
|
||||
g_return_if_fail (core_name);
|
||||
g_return_if_fail (*core_name != '\0');
|
||||
@@ -997,8 +1105,14 @@ void gncQueryRegisterCoreObject (char const *core_name,
|
||||
|
||||
if (toString)
|
||||
g_hash_table_insert (toStringTable, (char *)core_name, toString);
|
||||
|
||||
if (pred_equal)
|
||||
g_hash_table_insert (predEqualTable, (char *)core_name, pred_equal);
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* PUBLISHED API FUNCTIONS */
|
||||
|
||||
void gncQueryCoreInit (void)
|
||||
{
|
||||
/* Only let us initialize once */
|
||||
@@ -1011,6 +1125,7 @@ void gncQueryCoreInit (void)
|
||||
copyTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
freeTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
toStringTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
predEqualTable = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
init_tables ();
|
||||
}
|
||||
@@ -1025,6 +1140,7 @@ void gncQueryCoreShutdown (void)
|
||||
g_hash_table_destroy (copyTable);
|
||||
g_hash_table_destroy (freeTable);
|
||||
g_hash_table_destroy (toStringTable);
|
||||
g_hash_table_destroy (predEqualTable);
|
||||
}
|
||||
|
||||
QueryPredicate gncQueryCoreGetPredicate (char const *type)
|
||||
@@ -1039,18 +1155,6 @@ QueryCompare gncQueryCoreGetCompare (char const *type)
|
||||
return g_hash_table_lookup (cmpTable, type);
|
||||
}
|
||||
|
||||
QueryPredicateCopy gncQueryCoreGetCopy (char const *type)
|
||||
{
|
||||
g_return_val_if_fail (type, NULL);
|
||||
return g_hash_table_lookup (copyTable, type);
|
||||
}
|
||||
|
||||
QueryPredDataFree gncQueryCoreGetPredFree (char const *type)
|
||||
{
|
||||
g_return_val_if_fail (type, NULL);
|
||||
return g_hash_table_lookup (freeTable, type);
|
||||
}
|
||||
|
||||
void gncQueryCorePredicateFree (QueryPredData_t pdata)
|
||||
{
|
||||
QueryPredDataFree free_fcn;
|
||||
@@ -1087,3 +1191,19 @@ char * gncQueryCoreToString (char const *type, gpointer object,
|
||||
|
||||
return toString (object, get);
|
||||
}
|
||||
|
||||
gboolean gncQueryCorePredicateEqual (QueryPredData_t p1, QueryPredData_t p2)
|
||||
{
|
||||
QueryPredicateEqual pred_equal;
|
||||
|
||||
if (p1 == p2) return TRUE;
|
||||
if (!p1 || !p2) return FALSE;
|
||||
|
||||
if (p1->how != p2->how) return FALSE;
|
||||
if (safe_strcmp (p1->type_name, p2->type_name)) return FALSE;
|
||||
|
||||
pred_equal = g_hash_table_lookup (predEqualTable, p1->type_name);
|
||||
g_return_val_if_fail (pred_equal, FALSE);
|
||||
|
||||
return pred_equal (p1, p2);
|
||||
}
|
||||
+76
-68
@@ -7,85 +7,79 @@
|
||||
#ifndef GNC_QUERYCORE_H
|
||||
#define GNC_QUERYCORE_H
|
||||
|
||||
#include "QueryObject.h" /* for QueryAccess */
|
||||
#include "QueryNew.h" /* for QueryPredData_t */
|
||||
#include "gnc-numeric.h"
|
||||
#include "date.h"
|
||||
#include "kvp_frame.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct query_pred_data *QueryPredData_t;
|
||||
|
||||
/* Type of Query Core Objects (String, Date, Numeric, GUID, etc. */
|
||||
typedef const char * QueryCoreType;
|
||||
|
||||
/* Standard Query comparitors, for how to compare objects in a predicate.
|
||||
* Note that not all core types implement all comparitors
|
||||
*/
|
||||
typedef enum {
|
||||
COMPARE_LT = 1,
|
||||
COMPARE_LTE,
|
||||
COMPARE_EQUAL,
|
||||
COMPARE_GT,
|
||||
COMPARE_GTE,
|
||||
COMPARE_NEQ
|
||||
} query_compare_t;
|
||||
|
||||
/*
|
||||
* List of known core query data-types...
|
||||
* Each core query type defines it's set of optional "comparitor qualifiers".
|
||||
*/
|
||||
#define QUERYCORE_STRING "string"
|
||||
typedef enum {
|
||||
STRING_MATCH_NORMAL = 1,
|
||||
STRING_MATCH_CASEINSENSITIVE
|
||||
} string_match_t;
|
||||
|
||||
#define QUERYCORE_DATE "date"
|
||||
typedef enum {
|
||||
DATE_MATCH_NORMAL = 1,
|
||||
DATE_MATCH_ROUNDED
|
||||
} date_match_t;
|
||||
|
||||
#define QUERYCORE_NUMERIC "numeric"
|
||||
#define QUERYCORE_DEBCRED "debcred"
|
||||
typedef enum {
|
||||
NUMERIC_MATCH_DEBIT = 1,
|
||||
NUMERIC_MATCH_CREDIT,
|
||||
NUMERIC_MATCH_ANY
|
||||
} numeric_match_t;
|
||||
|
||||
#define QUERYCORE_GUID "guid"
|
||||
typedef enum {
|
||||
GUID_MATCH_ANY = 1,
|
||||
GUID_MATCH_ALL, /* You _must_ pass a GList of objects! */
|
||||
GUID_MATCH_NONE,
|
||||
GUID_MATCH_NULL,
|
||||
} guid_match_t;
|
||||
|
||||
#define QUERYCORE_INT64 "gint64"
|
||||
#define QUERYCORE_DOUBLE "double"
|
||||
#define QUERYCORE_BOOLEAN "boolean"
|
||||
#define QUERYCORE_KVP "kvp"
|
||||
|
||||
/* A CHAR type is for a RECNCell */
|
||||
#define QUERYCORE_CHAR "character"
|
||||
typedef enum {
|
||||
CHAR_MATCH_ANY = 1,
|
||||
CHAR_MATCH_NONE
|
||||
} char_match_t;
|
||||
|
||||
/* Head of Predicate Data structures. All PData must start like this. */
|
||||
typedef struct query_pred_data {
|
||||
const char * type_name;
|
||||
QueryCoreType type_name; /* QUERYCORE_* */
|
||||
query_compare_t how;
|
||||
} QueryPredDataDef;
|
||||
|
||||
/*
|
||||
* An arbitrary Query Predicate. Given the gnucash object and the
|
||||
* particular parameter get-function (obtained from the registry by
|
||||
* the Query internals), compare the object's parameter to the
|
||||
* predicate data
|
||||
*/
|
||||
typedef int (*QueryPredicate) (gpointer object,
|
||||
QueryAccess get_fcn,
|
||||
QueryPredData_t pdata);
|
||||
|
||||
/* A callback for how to destroy a query predicate's pdata */
|
||||
typedef void (*QueryPredDataFree) (QueryPredData_t pdata);
|
||||
|
||||
/* A callback to copy a query's predicate data */
|
||||
typedef QueryPredData_t (*QueryPredicateCopy) (QueryPredData_t pdata);
|
||||
|
||||
/* A callback for how to compare two (same-type) objects based on a
|
||||
* common get_fcn (parameter member), using the provided comparrison
|
||||
* options (which are the type-specific options).
|
||||
*/
|
||||
typedef int (*QueryCompare) (gpointer a, gpointer b,
|
||||
gint compare_options,
|
||||
QueryAccess get_fcn);
|
||||
|
||||
/* A function to take the object, apply the get_fcn, and return
|
||||
* a printable string. Note that this QueryAccess function should
|
||||
* be returning a type equal to this core object type.
|
||||
*
|
||||
* Note that this string MUST be freed by the caller.
|
||||
*/
|
||||
typedef char * (*QueryToString) (gpointer object, QueryAccess get_fcn);
|
||||
|
||||
|
||||
/* This function registers a new Core Object with the QueryNew
|
||||
* subsystem. It maps the "core_name" object to the given
|
||||
* query_predicate, predicate_copy, and predicate_data_free functions.
|
||||
*/
|
||||
void gncQueryRegisterCoreObject (char const *type_name,
|
||||
QueryPredicate pred,
|
||||
QueryCompare comp,
|
||||
QueryPredicateCopy copy,
|
||||
QueryPredDataFree pd_free,
|
||||
QueryToString to_string);
|
||||
|
||||
|
||||
/* An example:
|
||||
*
|
||||
* gncQueryRegisterCoreObject (QUERYCORE_STRING, string_match_predicate,
|
||||
* string_compare_fcn, string_free_pdata,
|
||||
* string_print_fcn);
|
||||
*/
|
||||
|
||||
|
||||
/* XXX: Define the core data type predicate_data structures here? */
|
||||
|
||||
/* Copy a predicate */
|
||||
QueryPredData_t gncQueryCorePredicateCopy (QueryPredData_t pdata);
|
||||
|
||||
/* Destroy a type */
|
||||
void gncQueryCorePredicateFree (QueryPredData_t pdata);
|
||||
|
||||
/* Return a string for a core data object */
|
||||
char * gncQueryCoreToString (char const *type, gpointer object,
|
||||
QueryAccess fcn);
|
||||
|
||||
/* Core Data Type Predicates */
|
||||
QueryPredData_t gncQueryStringPredicate (query_compare_t how, char *str,
|
||||
string_match_t options,
|
||||
@@ -104,4 +98,18 @@ QueryPredData_t gncQueryCharPredicate (char_match_t options,
|
||||
QueryPredData_t gncQueryKVPPredicate (query_compare_t how,
|
||||
GSList *path, const kvp_value *value);
|
||||
|
||||
#include "QueryObject.h" /* for QueryAccess */
|
||||
|
||||
/* Copy a predicate */
|
||||
QueryPredData_t gncQueryCorePredicateCopy (QueryPredData_t pdata);
|
||||
|
||||
/* Destroy a predicate */
|
||||
void gncQueryCorePredicateFree (QueryPredData_t pdata);
|
||||
|
||||
/* Return a printable string for a core data object. Caller needs
|
||||
* to g_free() the returned string
|
||||
*/
|
||||
char * gncQueryCoreToString (char const *type, gpointer object,
|
||||
QueryAccess fcn);
|
||||
|
||||
#endif /* GNC_QUERYCORE_H */
|
||||
+90
-2
@@ -7,16 +7,104 @@
|
||||
#ifndef GNC_QUERYCOREP_H
|
||||
#define GNC_QUERYCOREP_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <glib.h>
|
||||
#include <regex.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "QueryCore.h"
|
||||
|
||||
/* Initalize the Query Core registry and install the default type handlers */
|
||||
void gncQueryCoreInit(void);
|
||||
void gncQueryCoreShutdown (void);
|
||||
|
||||
/*
|
||||
* An arbitrary Query Predicate. Given the gnucash object and the
|
||||
* particular parameter get-function (obtained from the registry by
|
||||
* the Query internals), compare the object's parameter to the
|
||||
* predicate data
|
||||
*/
|
||||
typedef int (*QueryPredicate) (gpointer object,
|
||||
QueryAccess get_fcn,
|
||||
QueryPredData_t pdata);
|
||||
|
||||
/* A callback for how to compare two (same-type) objects based on a
|
||||
* common get_fcn (parameter member), using the provided comparrison
|
||||
* options (which are the type-specific options).
|
||||
*/
|
||||
typedef int (*QueryCompare) (gpointer a, gpointer b,
|
||||
gint compare_options,
|
||||
QueryAccess get_fcn);
|
||||
|
||||
/* Lookup functions */
|
||||
QueryPredicate gncQueryCoreGetPredicate (char const *type);
|
||||
QueryCompare gncQueryCoreGetCompare (char const *type);
|
||||
QueryPredicateCopy gncQueryCoreGetCopy (char const *type);
|
||||
QueryPredDataFree gncQueryCoreGetPredFree (char const *type);
|
||||
|
||||
/* Compare two predicates */
|
||||
gboolean gncQueryCorePredicateEqual (QueryPredData_t p1, QueryPredData_t p2);
|
||||
|
||||
/* Predicate Data Structures:
|
||||
*
|
||||
* These are defined such that you can cast between these types and
|
||||
* a QueryPredData_t.
|
||||
*
|
||||
* Note that these are provided for READ ONLY PURPOSES. You should NEVER
|
||||
* write into these structures, change them, or use them to create a
|
||||
* Query.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
string_match_t options;
|
||||
gboolean is_regex;
|
||||
char * matchstring;
|
||||
regex_t compiled;
|
||||
} query_string_def, *query_string_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
date_match_t options;
|
||||
Timespec date;
|
||||
} query_date_def, *query_date_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
numeric_match_t options;
|
||||
gnc_numeric amount;
|
||||
} query_numeric_def, *query_numeric_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
guid_match_t options;
|
||||
GList * guids;
|
||||
} query_guid_def, *query_guid_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
gint64 val;
|
||||
} query_int64_def, *query_int64_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
double val;
|
||||
} query_double_def, *query_double_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
gboolean val;
|
||||
} query_boolean_def, *query_boolean_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
char_match_t options;
|
||||
char * char_list;
|
||||
} query_char_def, *query_char_t;
|
||||
|
||||
typedef struct {
|
||||
QueryPredDataDef pd;
|
||||
GSList * path;
|
||||
kvp_value * value;
|
||||
} query_kvp_def, *query_kvp_t;
|
||||
|
||||
#endif /* GNC_QUERYCOREP_H */
|
||||
+250
-50
@@ -15,16 +15,15 @@
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-book-p.h"
|
||||
#include "gncObject.h"
|
||||
//#include "BackendP.h"
|
||||
#include "BackendP.h"
|
||||
|
||||
#include "QueryObjectP.h"
|
||||
#include "QueryCoreP.h"
|
||||
#include "QueryNew.h"
|
||||
#include "QueryNewP.h"
|
||||
|
||||
static short module = MOD_QUERY;
|
||||
|
||||
typedef struct {
|
||||
typedef struct query_new_term {
|
||||
GSList * param_list;
|
||||
QueryPredData_t pdata;
|
||||
gboolean invert;
|
||||
@@ -38,7 +37,7 @@ typedef struct {
|
||||
QueryPredicate pred_fcn;
|
||||
} QueryNewTerm;
|
||||
|
||||
typedef struct {
|
||||
typedef struct query_new_sort {
|
||||
GSList * param_list;
|
||||
gint options;
|
||||
gboolean increasing;
|
||||
@@ -52,20 +51,23 @@ typedef struct {
|
||||
GSList * param_fcns;
|
||||
QuerySort obj_cmp; /* In case you are comparing objects */
|
||||
QueryCompare comp_fcn; /* When you are comparing core types */
|
||||
} QuerySort_t;
|
||||
} QueryNewSort;
|
||||
|
||||
/* The QUERY structure */
|
||||
struct querynew_s {
|
||||
/* The object type that we're searching for */
|
||||
GNCIdType search_for;
|
||||
|
||||
/* terms is a list of the OR-terms in a sum-of-products
|
||||
* logical expression. */
|
||||
GList * terms;
|
||||
|
||||
/* sorting and chopping is independent of the search filter */
|
||||
|
||||
QuerySort_t primary_sort;
|
||||
QuerySort_t secondary_sort;
|
||||
QuerySort_t tertiary_sort;
|
||||
QuerySort defaultSort;
|
||||
QueryNewSort primary_sort;
|
||||
QueryNewSort secondary_sort;
|
||||
QueryNewSort tertiary_sort;
|
||||
QuerySort defaultSort; /* <- Computed from search_for */
|
||||
|
||||
/* The maximum number of results to return */
|
||||
int max_results;
|
||||
@@ -76,7 +78,6 @@ struct querynew_s {
|
||||
/* cache the results so we don't have to run the whole search
|
||||
* again until it's really necessary */
|
||||
int changed;
|
||||
GNCIdType last_run_type;
|
||||
|
||||
GList * results;
|
||||
};
|
||||
@@ -194,14 +195,14 @@ copy_or_terms(GList * or_terms)
|
||||
return g_list_reverse(or);
|
||||
}
|
||||
|
||||
static void copy_sort (QuerySort_t *dst, const QuerySort_t *src)
|
||||
static void copy_sort (QueryNewSort_t dst, const QueryNewSort_t src)
|
||||
{
|
||||
memcpy (dst, src, sizeof (*dst));
|
||||
dst->param_list = g_slist_copy (src->param_list);
|
||||
dst->param_fcns = g_slist_copy (src->param_fcns);
|
||||
}
|
||||
|
||||
static void free_sort (QuerySort_t *s)
|
||||
static void free_sort (QueryNewSort_t s)
|
||||
{
|
||||
g_slist_free (s->param_list);
|
||||
s->param_list = NULL;
|
||||
@@ -244,7 +245,7 @@ static void free_members (QueryNew *q)
|
||||
q->results = NULL;
|
||||
}
|
||||
|
||||
static int cmp_func (QuerySort_t *sort, QuerySort default_sort,
|
||||
static int cmp_func (QueryNewSort_t sort, QuerySort default_sort,
|
||||
gconstpointer a, gconstpointer b)
|
||||
{
|
||||
GSList *node;
|
||||
@@ -394,7 +395,7 @@ static GSList * compile_params (GSList *param_list, GNCIdType start_obj,
|
||||
return (g_slist_reverse (fcns));
|
||||
}
|
||||
|
||||
static void compile_sort (QuerySort_t *sort, GNCIdType obj)
|
||||
static void compile_sort (QueryNewSort_t sort, GNCIdType obj)
|
||||
{
|
||||
const QueryObjectDef *resObj = NULL;
|
||||
|
||||
@@ -431,7 +432,7 @@ static void compile_terms (QueryNew *q)
|
||||
GList *or_ptr, *and_ptr;
|
||||
|
||||
/* Find the specific functions for this Query. Note that the
|
||||
* Query's last_run_type should now be set to the new type.
|
||||
* Query's search_for should now be set to the new type.
|
||||
*/
|
||||
for (or_ptr = q->terms; or_ptr; or_ptr = or_ptr->next) {
|
||||
for (and_ptr = or_ptr->data; and_ptr; and_ptr = and_ptr->next) {
|
||||
@@ -442,7 +443,7 @@ static void compile_terms (QueryNew *q)
|
||||
qt->param_fcns = NULL;
|
||||
|
||||
/* Walk the parameter list of obtain the parameter functions */
|
||||
qt->param_fcns = compile_params (qt->param_list, q->last_run_type,
|
||||
qt->param_fcns = compile_params (qt->param_list, q->search_for,
|
||||
&resObj);
|
||||
|
||||
/* If we have valid parameters, grab the predicate function,
|
||||
@@ -457,11 +458,11 @@ static void compile_terms (QueryNew *q)
|
||||
}
|
||||
|
||||
/* Update the sort functions */
|
||||
compile_sort (&(q->primary_sort), q->last_run_type);
|
||||
compile_sort (&(q->secondary_sort), q->last_run_type);
|
||||
compile_sort (&(q->tertiary_sort), q->last_run_type);
|
||||
compile_sort (&(q->primary_sort), q->search_for);
|
||||
compile_sort (&(q->secondary_sort), q->search_for);
|
||||
compile_sort (&(q->tertiary_sort), q->search_for);
|
||||
|
||||
q->defaultSort = gncQueryObjectDefaultSort (q->last_run_type);
|
||||
q->defaultSort = gncQueryObjectDefaultSort (q->search_for);
|
||||
}
|
||||
|
||||
static void check_item_cb (gpointer object, gpointer user_data)
|
||||
@@ -515,18 +516,6 @@ static GList * merge_books (GList *l1, GList *l2)
|
||||
/********************************************************************/
|
||||
/* PUBLISHED API FUNCTIONS */
|
||||
|
||||
void gncQueryNewInit (void)
|
||||
{
|
||||
gncQueryCoreInit ();
|
||||
gncQueryObjectInit ();
|
||||
}
|
||||
|
||||
void gncQueryNewShutdown (void)
|
||||
{
|
||||
gncQueryObjectShutdown ();
|
||||
gncQueryCoreShutdown ();
|
||||
}
|
||||
|
||||
void gncQueryAddTerm (QueryNew *q, GSList *param_list,
|
||||
QueryPredData_t pred_data, QueryOp op)
|
||||
{
|
||||
@@ -582,21 +571,20 @@ void gncQueryPurgeTerms (QueryNew *q, GSList *param_list)
|
||||
}
|
||||
}
|
||||
|
||||
GList * gncQueryRun (QueryNew *q, GNCIdTypeConst obj_type)
|
||||
GList * gncQueryRun (QueryNew *q)
|
||||
{
|
||||
GList *matching_objects = NULL;
|
||||
GList *node;
|
||||
int object_count = 0;
|
||||
|
||||
if (!q || !obj_type) return NULL;
|
||||
if (!q) return NULL;
|
||||
g_return_val_if_fail (q->search_for, NULL);
|
||||
|
||||
/* XXX: Prioritize the query terms? */
|
||||
|
||||
/* prepare the Query for processing */
|
||||
if (q->changed || safe_strcmp (q->last_run_type, obj_type)) {
|
||||
q->last_run_type = (GNCIdType)obj_type;
|
||||
if (q->changed)
|
||||
compile_terms (q);
|
||||
}
|
||||
|
||||
/* Now run the query over all the objects and save the results */
|
||||
{
|
||||
@@ -608,16 +596,14 @@ GList * gncQueryRun (QueryNew *q, GNCIdTypeConst obj_type)
|
||||
/* For each book */
|
||||
for (node=q->books; node; node=node->next) {
|
||||
GNCBook *book = node->data;
|
||||
#if 0 /* XXX FIXME! */
|
||||
Backend *be = book->backend;
|
||||
|
||||
/* query the backend */
|
||||
if (be && be->run_query)
|
||||
(be->run_query) (be, q);
|
||||
#endif
|
||||
|
||||
/* and then iterate over all the objects */
|
||||
gncObjectForeach (obj_type, book, check_item_cb, &qcb);
|
||||
gncObjectForeach (q->search_for, book, check_item_cb, &qcb);
|
||||
}
|
||||
|
||||
matching_objects = qcb.list;
|
||||
@@ -675,6 +661,15 @@ GList * gncQueryRun (QueryNew *q, GNCIdTypeConst obj_type)
|
||||
return matching_objects;
|
||||
}
|
||||
|
||||
GList *
|
||||
gncQueryLastRun (QueryNew *query)
|
||||
{
|
||||
if (!query)
|
||||
return NULL;
|
||||
|
||||
return query->results;
|
||||
}
|
||||
|
||||
void gncQueryClear (QueryNew *query)
|
||||
{
|
||||
QueryNew *q2 = gncQueryCreate ();
|
||||
@@ -695,6 +690,27 @@ QueryNew * gncQueryCreate (void)
|
||||
return qp;
|
||||
}
|
||||
|
||||
void gncQuerySearchFor (QueryNew *q, GNCIdTypeConst obj_type)
|
||||
{
|
||||
if (!q || !obj_type)
|
||||
return;
|
||||
|
||||
if (safe_strcmp (q->search_for, obj_type)) {
|
||||
q->search_for = (GNCIdType) obj_type;
|
||||
q->changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
QueryNew * gncQueryCreateFor (GNCIdTypeConst obj_type)
|
||||
{
|
||||
QueryNew *q;
|
||||
if (!obj_type)
|
||||
return NULL;
|
||||
q = gncQueryCreate ();
|
||||
gncQuerySearchFor (q, obj_type);
|
||||
return q;
|
||||
}
|
||||
|
||||
int gncQueryHasTerms (QueryNew *q)
|
||||
{
|
||||
if (!q) return 0;
|
||||
@@ -711,10 +727,23 @@ int gncQueryNumTerms (QueryNew *q)
|
||||
return n;
|
||||
}
|
||||
|
||||
GList * gncQueryGetTerms (QueryNew *q)
|
||||
gboolean gncQueryHasTermType (QueryNew *q, GSList *term_param)
|
||||
{
|
||||
if (!q) return NULL;
|
||||
return q->terms;
|
||||
GList *or;
|
||||
GList *and;
|
||||
|
||||
if (!q || !term_param)
|
||||
return FALSE;
|
||||
|
||||
for(or = q->terms; or; or = or->next) {
|
||||
for(and = or->data; and; and = and->next) {
|
||||
QueryNewTerm *qt = and->data;
|
||||
if (!param_list_cmp (term_param, qt->param_list))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void gncQueryDestroy (QueryNew *q)
|
||||
@@ -760,6 +789,9 @@ QueryNew * gncQueryInvert (QueryNew *q)
|
||||
GList * new_oterm;
|
||||
int num_or_terms;
|
||||
|
||||
if (!q)
|
||||
return NULL;
|
||||
|
||||
num_or_terms = g_list_length(q->terms);
|
||||
|
||||
switch(num_or_terms)
|
||||
@@ -775,6 +807,8 @@ QueryNew * gncQueryInvert (QueryNew *q)
|
||||
retval = gncQueryCreate();
|
||||
retval->max_results = q->max_results;
|
||||
retval->books = g_list_copy (q->books);
|
||||
retval->search_for = q->search_for;
|
||||
retval->changed = 1;
|
||||
|
||||
aterms = g_list_nth_data(q->terms, 0);
|
||||
new_oterm = NULL;
|
||||
@@ -803,6 +837,7 @@ QueryNew * gncQueryInvert (QueryNew *q)
|
||||
retval = gncQueryMerge(iright, ileft, QUERY_AND);
|
||||
retval->books = g_list_copy (q->books);
|
||||
retval->max_results = q->max_results;
|
||||
retval->search_for = q->search_for;
|
||||
retval->changed = 1;
|
||||
|
||||
gncQueryDestroy(iright);
|
||||
@@ -827,8 +862,14 @@ QueryNew * gncQueryMerge(QueryNew *q1, QueryNew *q2, QueryOp op)
|
||||
QueryNew * i1, * i2;
|
||||
QueryNew * t1, * t2;
|
||||
GList * i, * j;
|
||||
GNCIdType search_for;
|
||||
|
||||
if(!q1 || !q2 ) return NULL;
|
||||
if (q1->search_for && q2->search_for)
|
||||
g_return_val_if_fail (safe_strcmp (q1->search_for, q2->search_for) == 0,
|
||||
NULL);
|
||||
|
||||
search_for = (q1->search_for ? q1->search_for : q2->search_for);
|
||||
|
||||
switch(op)
|
||||
{
|
||||
@@ -893,21 +934,41 @@ QueryNew * gncQueryMerge(QueryNew *q1, QueryNew *q2, QueryOp op)
|
||||
break;
|
||||
}
|
||||
|
||||
retval->search_for = search_for;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
gncQueryMergeInPlace(QueryNew *q1, QueryNew *q2, QueryOp op)
|
||||
{
|
||||
QueryNew *tmp_q;
|
||||
|
||||
if (!q1 || !q2)
|
||||
return;
|
||||
|
||||
tmp_q = gncQueryMerge (q1, q2, op);
|
||||
swap_terms (q1, tmp_q);
|
||||
gncQueryDestroy (tmp_q);
|
||||
}
|
||||
|
||||
void
|
||||
gncQuerySetSortOrder (QueryNew *q,
|
||||
GSList *params1, GSList *params2, GSList *params3)
|
||||
{
|
||||
if (!q) return;
|
||||
if (q->primary_sort.param_list)
|
||||
g_slist_free (q->primary_sort.param_list);
|
||||
q->primary_sort.param_list = params1;
|
||||
q->primary_sort.options = 0;
|
||||
|
||||
if (q->secondary_sort.param_list)
|
||||
g_slist_free (q->secondary_sort.param_list);
|
||||
q->secondary_sort.param_list = params2;
|
||||
q->secondary_sort.options = 0;
|
||||
|
||||
q->tertiary_sort.param_list = params2;
|
||||
if (q->tertiary_sort.param_list)
|
||||
g_slist_free (q->tertiary_sort.param_list);
|
||||
q->tertiary_sort.param_list = params3;
|
||||
q->tertiary_sort.options = 0;
|
||||
|
||||
q->changed = 1;
|
||||
@@ -937,12 +998,6 @@ void gncQuerySetMaxResults (QueryNew *q, int n)
|
||||
q->max_results = n;
|
||||
}
|
||||
|
||||
int gncQueryGetMaxResults (QueryNew *q)
|
||||
{
|
||||
if (!q) return 0;
|
||||
return q->max_results;
|
||||
}
|
||||
|
||||
void gncQueryAddGUIDListMatch (QueryNew *q, GSList *param_list,
|
||||
GList *guid_list, guid_match_t options,
|
||||
QueryOp op)
|
||||
@@ -985,3 +1040,148 @@ void gncQuerySetBook (QueryNew *q, GNCBook *book)
|
||||
gnc_book_get_guid(book), QUERY_AND);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* PRIVATE PUBLISHED API FUNCTIONS */
|
||||
|
||||
void gncQueryNewInit (void)
|
||||
{
|
||||
gncQueryCoreInit ();
|
||||
gncQueryObjectInit ();
|
||||
}
|
||||
|
||||
void gncQueryNewShutdown (void)
|
||||
{
|
||||
gncQueryObjectShutdown ();
|
||||
gncQueryCoreShutdown ();
|
||||
}
|
||||
|
||||
int gncQueryGetMaxResults (QueryNew *q)
|
||||
{
|
||||
if (!q) return 0;
|
||||
return q->max_results;
|
||||
}
|
||||
|
||||
GNCIdType gncQueryGetSearchFor (QueryNew *q)
|
||||
{
|
||||
if (!q) return NULL;
|
||||
return q->search_for;
|
||||
}
|
||||
|
||||
GList * gncQueryGetTerms (QueryNew *q)
|
||||
{
|
||||
if (!q) return NULL;
|
||||
return q->terms;
|
||||
}
|
||||
|
||||
GSList * gncQueryTermGetParamPath (QueryNewTerm_t qt)
|
||||
{
|
||||
if (!qt)
|
||||
return NULL;
|
||||
return qt->param_list;
|
||||
}
|
||||
|
||||
QueryPredData_t gncQueryTermGetPredData (QueryNewTerm_t qt)
|
||||
{
|
||||
if (!qt)
|
||||
return NULL;
|
||||
return qt->pdata;
|
||||
}
|
||||
|
||||
gboolean gncQueryTermIsInverted (QueryNewTerm_t qt)
|
||||
{
|
||||
if (!qt)
|
||||
return FALSE;
|
||||
return qt->invert;
|
||||
}
|
||||
|
||||
void gncQueryGetSorts (QueryNew *q, QueryNewSort_t *primary,
|
||||
QueryNewSort_t *secondary, QueryNewSort_t *tertiary)
|
||||
{
|
||||
if (!q)
|
||||
return;
|
||||
if (primary)
|
||||
*primary = &(q->primary_sort);
|
||||
if (secondary)
|
||||
*secondary = &(q->secondary_sort);
|
||||
if (tertiary)
|
||||
*tertiary = &(q->tertiary_sort);
|
||||
}
|
||||
|
||||
GSList * gncQuerySortGetParamPath (QueryNewSort_t qs)
|
||||
{
|
||||
if (!qs)
|
||||
return NULL;
|
||||
return qs->param_list;
|
||||
}
|
||||
|
||||
gint gncQuerySortGetSortOptions (QueryNewSort_t qs)
|
||||
{
|
||||
if (!qs)
|
||||
return 0;
|
||||
return qs->options;
|
||||
}
|
||||
|
||||
gboolean gncQuerySortGetIncreasing (QueryNewSort_t qs)
|
||||
{
|
||||
if (!qs)
|
||||
return FALSE;
|
||||
return qs->increasing;
|
||||
}
|
||||
|
||||
static gboolean gncQueryTermEqual (QueryNewTerm_t qt1, QueryNewTerm_t qt2)
|
||||
{
|
||||
if (qt1 == qt2) return TRUE;
|
||||
if (!qt1 || !qt2) return FALSE;
|
||||
|
||||
if (qt1->invert != qt2->invert) return FALSE;
|
||||
if (param_list_cmp (qt1->param_list, qt2->param_list)) return FALSE;
|
||||
return gncQueryCorePredicateEqual (qt1->pdata, qt2->pdata);
|
||||
}
|
||||
|
||||
static gboolean gncQuerySortEqual (QueryNewSort_t qs1, QueryNewSort_t qs2)
|
||||
{
|
||||
if (qs1 == qs2) return TRUE;
|
||||
if (!qs1 || !qs2) return FALSE;
|
||||
|
||||
/* "Empty" sorts are equivalent, regardless of the flags */
|
||||
if (!qs1->param_list && !qs2->param_list) return TRUE;
|
||||
|
||||
if (qs1->options != qs2->options) return FALSE;
|
||||
if (qs1->increasing != qs2->increasing) return FALSE;
|
||||
return (param_list_cmp (qs1->param_list, qs2->param_list) == 0);
|
||||
}
|
||||
|
||||
gboolean gncQueryEqual (QueryNew *q1, QueryNew *q2)
|
||||
{
|
||||
GList *or1, *or2;
|
||||
|
||||
if (q1 == q2) return TRUE;
|
||||
if (!q1 || !q2) return FALSE;
|
||||
|
||||
if (g_list_length (q1->terms) != g_list_length (q2->terms)) return FALSE;
|
||||
if (q1->max_results != q2->max_results) return FALSE;
|
||||
|
||||
for (or1 = q1->terms, or2 = q2->terms; or1;
|
||||
or1 = or1->next, or2 = or2->next)
|
||||
{
|
||||
GList *and1, *and2;
|
||||
|
||||
and1 = or1->data;
|
||||
and2 = or2->data;
|
||||
|
||||
if (g_list_length (and1) != g_list_length (and2)) return FALSE;
|
||||
|
||||
for ( ; and1; and1 = and1->next, and2 = and2->next)
|
||||
if (!gncQueryTermEqual (and1->data, and2->data))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gncQuerySortEqual (&(q1->primary_sort), &(q2->primary_sort)))
|
||||
return FALSE;
|
||||
if (!gncQuerySortEqual (&(q1->secondary_sort), &(q2->secondary_sort)))
|
||||
return FALSE;
|
||||
if (!gncQuerySortEqual (&(q1->tertiary_sort), &(q2->tertiary_sort)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
+43
-118
@@ -8,12 +8,11 @@
|
||||
#define GNC_QUERYNEW_H
|
||||
|
||||
#include "GNCId.h"
|
||||
#include "QueryCore.h"
|
||||
|
||||
/* A Query */
|
||||
typedef struct querynew_s QueryNew;
|
||||
|
||||
/* in case Query.h is included first... */
|
||||
#ifndef GNUCASH_QUERY_H
|
||||
/* Query Term Operators, for combining Query Terms */
|
||||
typedef enum {
|
||||
QUERY_AND=1,
|
||||
@@ -22,117 +21,29 @@ typedef enum {
|
||||
QUERY_NOR,
|
||||
QUERY_XOR
|
||||
} QueryOp;
|
||||
#endif
|
||||
|
||||
/* Standard Query Term comparitors, for how to process a query term.
|
||||
* Note that not all core types implement all comparitors
|
||||
*/
|
||||
typedef enum {
|
||||
COMPARE_LT = 1,
|
||||
COMPARE_LTE,
|
||||
COMPARE_EQUAL,
|
||||
COMPARE_GT,
|
||||
COMPARE_GTE,
|
||||
COMPARE_NEQ
|
||||
} query_compare_t;
|
||||
|
||||
/* Default sort object type */
|
||||
#define QUERY_DEFAULT_SORT "GnucashQueryDefaultSortObject"
|
||||
|
||||
/* "Known" Object Parameters */
|
||||
/* "Known" Object Parameters -- all objects must support these */
|
||||
#define QUERY_PARAM_BOOK "book"
|
||||
#define QUERY_PARAM_GUID "guid"
|
||||
|
||||
#define SPLIT_KVP "kvp"
|
||||
#define SPLIT_DATE_RECONCILED "date-reconciled"
|
||||
#define SPLIT_BALANCE "balance"
|
||||
#define SPLIT_CLEARED_BALANCE "cleared-balance"
|
||||
#define SPLIT_RECONCILED_BALANCE "reconciled-balance"
|
||||
#define SPLIT_MEMO "memo"
|
||||
#define SPLIT_ACTION "action"
|
||||
#define SPLIT_RECONCILE "reconcile-flag"
|
||||
#define SPLIT_AMOUNT "amount"
|
||||
#define SPLIT_SHARE_PRICE "share-price"
|
||||
#define SPLIT_VALUE "value"
|
||||
#define SPLIT_TYPE "type"
|
||||
#define SPLIT_VOIDED_AMOUNT "voided-amount"
|
||||
#define SPLIT_VOIDED_VALUE "voided-value"
|
||||
#define SPLIT_TRANS "trans"
|
||||
#define SPLIT_ACCOUNT "account"
|
||||
#define SPLIT_ACCOUNT_GUID "account-guid" /* for guid_match_all */
|
||||
|
||||
#define TRANS_KVP "kvp"
|
||||
#define TRANS_NUM "num"
|
||||
#define TRANS_DESCRIPTON "desc"
|
||||
#define TRANS_DATE_ENTERED "date-entered"
|
||||
#define TRANS_DATE_POSTED "date-posted"
|
||||
#define TRANS_DATE_DUE "date-due"
|
||||
#define TRANS_TYPE "type"
|
||||
#define TRANS_VOID_STATUS "void-p"
|
||||
#define TRANS_VOID_REASON "void-reason"
|
||||
#define TRANS_VOID_TIME "void-time"
|
||||
#define TRANS_SPLITLIST "split-list" /* for guid_match_all */
|
||||
|
||||
#define ACCOUNT_KVP "kvp"
|
||||
#define ACCOUNT_NAME_ "name"
|
||||
#define ACCOUNT_CODE_ "code"
|
||||
#define ACCOUNT_DESCRIPTION_ "desc"
|
||||
#define ACCOUNT_NOTES_ "notes"
|
||||
#define ACCOUNT_BALANCE_ "balance"
|
||||
#define ACCOUNT_CLEARED_BALANCE "cleared-balance"
|
||||
#define ACCOUNT_RECONCILED_BALANCE "reconciled-balance"
|
||||
#define ACCOUNT_TAX_RELATED "tax-related-p"
|
||||
|
||||
#define BOOK_KVP "kvp"
|
||||
|
||||
/* Type of Query Core Objects (String, Date, Numeric, GUID, etc. */
|
||||
typedef const char * QueryCoreType;
|
||||
|
||||
/*
|
||||
* List of known core query types...
|
||||
* Each core query type defines it's set of optional "comparitor qualifiers".
|
||||
*/
|
||||
#define QUERYCORE_STRING "string"
|
||||
typedef enum {
|
||||
STRING_MATCH_NORMAL = 1,
|
||||
STRING_MATCH_CASEINSENSITIVE
|
||||
} string_match_t;
|
||||
|
||||
#define QUERYCORE_DATE "date"
|
||||
typedef enum {
|
||||
DATE_MATCH_NORMAL = 1,
|
||||
DATE_MATCH_ROUNDED
|
||||
} date_match_t;
|
||||
|
||||
#define QUERYCORE_NUMERIC "numeric"
|
||||
#define QUERYCORE_DEBCRED "debcred"
|
||||
typedef enum {
|
||||
NUMERIC_MATCH_DEBIT = 1,
|
||||
NUMERIC_MATCH_CREDIT,
|
||||
NUMERIC_MATCH_ANY
|
||||
} numeric_match_t;
|
||||
|
||||
#define QUERYCORE_GUID "guid"
|
||||
typedef enum {
|
||||
GUID_MATCH_ANY = 1,
|
||||
GUID_MATCH_NONE,
|
||||
GUID_MATCH_NULL,
|
||||
GUID_MATCH_ALL /* You _must_ pass a GList of objects! */
|
||||
} guid_match_t;
|
||||
|
||||
#define QUERYCORE_INT64 "gint64"
|
||||
#define QUERYCORE_DOUBLE "double"
|
||||
#define QUERYCORE_BOOLEAN "boolean"
|
||||
#define QUERYCORE_KVP "kvp"
|
||||
|
||||
/* A CHAR type is for a RECNCell */
|
||||
#define QUERYCORE_CHAR "character"
|
||||
typedef enum {
|
||||
CHAR_MATCH_ANY = 1,
|
||||
CHAR_MATCH_NONE
|
||||
} char_match_t;
|
||||
|
||||
/* Basic API Functions */
|
||||
|
||||
/* Create a new query. A Query MUST be set with a 'search-for' type.
|
||||
* you can create and set this value in one step or two */
|
||||
QueryNew * gncQueryCreate (void);
|
||||
QueryNew * gncQueryCreateFor (GNCIdTypeConst obj_type);
|
||||
void gncQueryDestroy (QueryNew *q);
|
||||
|
||||
/* Set the object type to be searched for */
|
||||
void gncQuerySearchFor (QueryNew *query, GNCIdTypeConst obj_type);
|
||||
|
||||
/* Set the book to be searched (you can search multiple books) */
|
||||
void gncQuerySetBook (QueryNew *q, GNCBook *book);
|
||||
|
||||
|
||||
/* This is the general function that adds a new Query Term to a query.
|
||||
* It will find the 'obj_type' object of the search item and compare
|
||||
* the 'param_list' parameter to the predicate data via the comparitor.
|
||||
@@ -147,42 +58,52 @@ typedef enum {
|
||||
*
|
||||
* acct_name_pred_data = make_string_pred_data(STRING_MATCH_CASEINSENSITIVE,
|
||||
* account_name);
|
||||
* param_list = make_list (SPLIT_ACCOUNT, ACCOUNT_NAME);
|
||||
* param_list = make_list (SPLIT_ACCOUNT, ACCOUNT_NAME, NULL);
|
||||
* gncQueryAddTerm (query, param_list, COMPARE_EQUAL,
|
||||
* acct_name_pred_data, QUERY_AND);
|
||||
*/
|
||||
|
||||
typedef struct query_pred_data *QueryPredData_t;
|
||||
|
||||
void gncQueryAddTerm (QueryNew *query, GSList *param_list,
|
||||
QueryPredData_t pred_data, QueryOp op);
|
||||
|
||||
void gncQuerySetBook (QueryNew *q, GNCBook *book);
|
||||
void gncQueryAddGUIDMatch (QueryNew *q, GSList *param_list,
|
||||
const GUID *guid, QueryOp op);
|
||||
void gncQueryAddGUIDListMatch (QueryNew *q, GSList *param_list,
|
||||
GList *guid_list, guid_match_t options,
|
||||
QueryOp op);
|
||||
|
||||
/* Run the query:
|
||||
*
|
||||
* ex: gncQueryRun (query, GNC_ID_SPLIT);
|
||||
*/
|
||||
GList * gncQueryRun (QueryNew *query, GNCIdTypeConst obj_type);
|
||||
/* Run the query: */
|
||||
GList * gncQueryRun (QueryNew *query);
|
||||
|
||||
QueryNew * gncQueryCreate (void);
|
||||
void gncQueryDestroy (QueryNew *q);
|
||||
/* Return the results of the last query, without re-running */
|
||||
GList * gncQueryLastRun (QueryNew *query);
|
||||
|
||||
void gncQueryClear (QueryNew *query);
|
||||
void gncQueryPurgeTerms (QueryNew *q, GSList *param_list);
|
||||
int gncQueryHasTerms (QueryNew *q);
|
||||
int gncQueryNumTerms (QueryNew *q);
|
||||
GList * gncQueryGetTerms (QueryNew *q);
|
||||
|
||||
gboolean gncQueryHasTermType (QueryNew *q, GSList *term_param);
|
||||
|
||||
QueryNew * gncQueryCopy (QueryNew *q);
|
||||
QueryNew * gncQueryInvert(QueryNew *q);
|
||||
|
||||
/* Merges two queries together. Both queries must be compatible
|
||||
* search-types. If both queries are set, they must search for the
|
||||
* same object type. If only one is set, the resulting query will
|
||||
* search for the set type. If neither query has the search-type set,
|
||||
* the result will be unset as well.
|
||||
*/
|
||||
QueryNew * gncQueryMerge(QueryNew *q1, QueryNew *q2, QueryOp op);
|
||||
|
||||
/* Like gncQueryMerge, but this will merge q2 into q1. q2 remains
|
||||
* unchanged.
|
||||
*/
|
||||
void gncQueryMergeInPlace(QueryNew *q1, QueryNew *q2, QueryOp op);
|
||||
|
||||
/* The lists become the property of the Query and will be freed
|
||||
* by the query when it is destroyed.
|
||||
*/
|
||||
void gncQuerySetSortOrder (QueryNew *q,
|
||||
GSList *primary_sort_params,
|
||||
GSList *secondary_sort_params,
|
||||
@@ -196,6 +117,10 @@ void gncQuerySetSortIncreasing (QueryNew *q, gboolean prim_inc,
|
||||
|
||||
|
||||
void gncQuerySetMaxResults (QueryNew *q, int n);
|
||||
int gncQueryGetMaxResults (QueryNew *q);
|
||||
|
||||
/* compare two queries for equality. this is a simplistic
|
||||
* implementation -- logical equivalences between different
|
||||
* and/or trees are ignored. */
|
||||
gboolean gncQueryEqual (QueryNew *q1, QueryNew *q2);
|
||||
|
||||
#endif /* GNC_QUERYNEW_H */
|
||||
@@ -6,8 +6,47 @@
|
||||
#ifndef GNC_QUERYNEWP_H
|
||||
#define GNC_QUERYNEWP_H
|
||||
|
||||
#include "QueryNew.h"
|
||||
|
||||
typedef struct query_new_term *QueryNewTerm_t;
|
||||
typedef struct query_new_sort *QueryNewSort_t;
|
||||
|
||||
/* Initialize/Shutdown */
|
||||
void gncQueryNewInit (void);
|
||||
void gncQueryNewShutdown (void);
|
||||
|
||||
/* Functions to get Query information */
|
||||
int gncQueryGetMaxResults (QueryNew *q);
|
||||
GNCIdType gncQueryGetSearchFor (QueryNew *q);
|
||||
|
||||
|
||||
/* Functions to get and look at QueryTerms */
|
||||
|
||||
/* This returns a List of List of Query Terms. Each list of Query
|
||||
* Terms are ANDed together, and each list of ANDed terms are ORed
|
||||
* together. So, what is returned is the 'or' list of 'and' lists
|
||||
* of query term objects.
|
||||
*
|
||||
* Note that you should NOT modify this list in any way. It belongs
|
||||
* to the query.
|
||||
*/
|
||||
GList * gncQueryGetTerms (QueryNew *q);
|
||||
|
||||
GSList * gncQueryTermGetParamPath (QueryNewTerm_t queryterm);
|
||||
QueryPredData_t gncQueryTermGetPredData (QueryNewTerm_t queryterm);
|
||||
gboolean gncQueryTermIsInverted (QueryNewTerm_t queryterm);
|
||||
|
||||
|
||||
/* Functions to get and look at QuerySorts */
|
||||
|
||||
/* This function returns the primary, secondary, and tertiary sorts.
|
||||
* These are part of the query and should NOT be changed!
|
||||
*/
|
||||
void gncQueryGetSorts (QueryNew *q, QueryNewSort_t *primary,
|
||||
QueryNewSort_t *secondary, QueryNewSort_t *tertiary);
|
||||
|
||||
GSList * gncQuerySortGetParamPath (QueryNewSort_t querysort);
|
||||
gint gncQuerySortGetSortOptions (QueryNewSort_t querysort);
|
||||
gboolean gncQuerySortGetIncreasing (QueryNewSort_t querysort);
|
||||
|
||||
#endif /* GNC_QUERYNEWP_H */
|
||||
@@ -6,11 +6,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <glib.h>
|
||||
#include <regex.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gnc-engine-util.h"
|
||||
#include "QueryObjectP.h"
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#ifndef GNC_QUERYOBJECT_H
|
||||
#define GNC_QUERYOBJECT_H
|
||||
|
||||
#include "QueryNew.h"
|
||||
|
||||
/* Define an arbitrary function pointer for access functions. This is
|
||||
* because C doesn't have templates, so we just cast a lot. Real
|
||||
* functions must be of the form:
|
||||
@@ -17,6 +15,9 @@
|
||||
*/
|
||||
typedef gpointer (*QueryAccess)(gpointer);
|
||||
|
||||
#include "QueryNew.h"
|
||||
#include "QueryCore.h"
|
||||
|
||||
/* This structure is for each queriable parameter in an object
|
||||
*
|
||||
* -- param_name is the name of the parameter.
|
||||
|
||||
+2
-11
@@ -24,18 +24,9 @@
|
||||
#ifndef GNUCASH_QUERY_P_H
|
||||
#define GNUCASH_QUERY_P_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <glib.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "date.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "GNCId.h"
|
||||
#include "guid.h"
|
||||
#include "kvp_frame.h"
|
||||
#include "Query.h"
|
||||
|
||||
#if 0
|
||||
|
||||
typedef struct {
|
||||
pd_type_t type;
|
||||
@@ -160,6 +151,6 @@ void xaccQueryAddPredicate (Query * q, PredicateData *pred, QueryOp op);
|
||||
/* This is useful for network systems */
|
||||
Predicate xaccQueryGetPredicate (pr_type_t term_type);
|
||||
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* GNUCASH_QUERY_P_H */
|
||||
@@ -305,8 +305,8 @@ xaccSplitEqual(const Split *sa, const Split *sb,
|
||||
char *str_a;
|
||||
char *str_b;
|
||||
|
||||
str_a = gnc_numeric_to_string (sa->amount);
|
||||
str_b = gnc_numeric_to_string (sb->amount);
|
||||
str_a = gnc_numeric_to_string (sa->value);
|
||||
str_b = gnc_numeric_to_string (sb->value);
|
||||
|
||||
PWARN ("values differ: %s vs %s", str_a, str_b);
|
||||
|
||||
@@ -3018,8 +3018,8 @@ xaccTransVoid(Transaction *transaction,
|
||||
val = kvp_value_new_gnc_numeric(amt);
|
||||
kvp_frame_set_slot_nc(frame, void_former_val_str, val);
|
||||
|
||||
split->amount = zero;
|
||||
split->value = zero;
|
||||
xaccSplitSetAmount (split, zero);
|
||||
xaccSplitSetValue (split, zero);
|
||||
xaccSplitSetReconcile(split, VREC);
|
||||
}
|
||||
|
||||
@@ -3149,6 +3149,11 @@ static gpointer split_account_guid_getter (gpointer obj)
|
||||
return ((gpointer)xaccAccountGetGUID (acc));
|
||||
}
|
||||
|
||||
static gpointer no_op (gpointer obj)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
|
||||
gboolean xaccSplitRegister (void)
|
||||
{
|
||||
static const QueryObjectDef params[] = {
|
||||
@@ -3178,12 +3183,24 @@ gboolean xaccSplitRegister (void)
|
||||
{ SPLIT_TRANS, GNC_ID_TRANS, (QueryAccess)xaccSplitGetParent },
|
||||
{ SPLIT_ACCOUNT, GNC_ID_ACCOUNT, (QueryAccess)xaccSplitGetAccount },
|
||||
{ SPLIT_ACCOUNT_GUID, QUERYCORE_GUID, split_account_guid_getter },
|
||||
{ SPLIT_ACCT_FULLNAME, SPLIT_ACCT_FULLNAME, no_op },
|
||||
{ SPLIT_CORR_ACCT_NAME, SPLIT_CORR_ACCT_NAME, no_op },
|
||||
{ SPLIT_CORR_ACCT_CODE, SPLIT_CORR_ACCT_CODE, no_op },
|
||||
{ QUERY_PARAM_BOOK, GNC_ID_BOOK, (QueryAccess)xaccSplitGetBook },
|
||||
{ QUERY_PARAM_GUID, QUERYCORE_GUID, (QueryAccess) xaccSplitGetGUID },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
gncQueryObjectRegister (GNC_ID_SPLIT, (QuerySort)xaccSplitDateOrder, params);
|
||||
gncQueryObjectRegister (SPLIT_ACCT_FULLNAME,
|
||||
(QuerySort)xaccSplitCompareAccountFullNames,
|
||||
NULL);
|
||||
gncQueryObjectRegister (SPLIT_CORR_ACCT_NAME,
|
||||
(QuerySort)xaccSplitCompareOtherAccountFullNames,
|
||||
NULL);
|
||||
gncQueryObjectRegister (SPLIT_CORR_ACCT_CODE,
|
||||
(QuerySort)xaccSplitCompareOtherAccountCodes,
|
||||
NULL);
|
||||
|
||||
return gncObjectRegister (&split_object_def);
|
||||
}
|
||||
@@ -3206,15 +3223,25 @@ static GncObject_t trans_object_def = {
|
||||
xaccTransGetDescription /* printable */
|
||||
};
|
||||
|
||||
static gboolean
|
||||
trans_is_balanced_p (Transaction *txn)
|
||||
{
|
||||
if (!txn)
|
||||
return FALSE;
|
||||
return (gnc_numeric_zero_p (xaccTransGetImbalance (txn)));
|
||||
}
|
||||
|
||||
gboolean xaccTransRegister (void)
|
||||
{
|
||||
static QueryObjectDef params[] = {
|
||||
{ TRANS_KVP, QUERYCORE_KVP, (QueryAccess)xaccTransGetSlots },
|
||||
{ TRANS_NUM, QUERYCORE_STRING, (QueryAccess)xaccTransGetNum },
|
||||
{ TRANS_DESCRIPTON, QUERYCORE_STRING, (QueryAccess)xaccTransGetDescription },
|
||||
{ TRANS_DESCRIPTION, QUERYCORE_STRING, (QueryAccess)xaccTransGetDescription },
|
||||
{ TRANS_DATE_ENTERED, QUERYCORE_DATE, (QueryAccess)xaccTransRetDateEnteredTS },
|
||||
{ TRANS_DATE_POSTED, QUERYCORE_DATE, (QueryAccess)xaccTransRetDatePostedTS },
|
||||
{ TRANS_DATE_DUE, QUERYCORE_DATE, (QueryAccess)xaccTransRetDateDueTS },
|
||||
{ TRANS_IMBALANCE, QUERYCORE_NUMERIC, (QueryAccess)xaccTransGetImbalance },
|
||||
{ TRANS_IS_BALANCED, QUERYCORE_BOOLEAN, (QueryAccess)trans_is_balanced_p },
|
||||
{ TRANS_TYPE, QUERYCORE_CHAR, (QueryAccess)xaccTransGetTxnType },
|
||||
{ TRANS_VOID_STATUS, QUERYCORE_BOOLEAN, (QueryAccess)xaccTransGetVoidStatus },
|
||||
{ TRANS_VOID_REASON, QUERYCORE_STRING, (QueryAccess)xaccTransGetVoidReason },
|
||||
|
||||
@@ -511,4 +511,50 @@ gnc_numeric xaccSplitVoidFormerAmount(Split *split);
|
||||
gnc_numeric xaccSplitVoidFormerValue(Split *split);
|
||||
|
||||
Timespec xaccTransGetVoidTime(Transaction *tr);
|
||||
|
||||
/* Parameter names */
|
||||
#define SPLIT_KVP "kvp"
|
||||
#define SPLIT_DATE_RECONCILED "date-reconciled"
|
||||
#define SPLIT_BALANCE "balance"
|
||||
#define SPLIT_CLEARED_BALANCE "cleared-balance"
|
||||
#define SPLIT_RECONCILED_BALANCE "reconciled-balance"
|
||||
#define SPLIT_MEMO "memo"
|
||||
#define SPLIT_ACTION "action"
|
||||
#define SPLIT_RECONCILE "reconcile-flag"
|
||||
#define SPLIT_AMOUNT "amount"
|
||||
#define SPLIT_SHARE_PRICE "share-price"
|
||||
#define SPLIT_VALUE "value"
|
||||
#define SPLIT_TYPE "type"
|
||||
#define SPLIT_VOIDED_AMOUNT "voided-amount"
|
||||
#define SPLIT_VOIDED_VALUE "voided-value"
|
||||
#define SPLIT_TRANS "trans"
|
||||
#define SPLIT_ACCOUNT "account"
|
||||
#define SPLIT_ACCOUNT_GUID "account-guid" /* for guid_match_all */
|
||||
|
||||
/* used for SORTING ONLY */
|
||||
#define SPLIT_ACCT_FULLNAME "acct-fullname"
|
||||
#define SPLIT_CORR_ACCT_NAME "corr-acct-fullname"
|
||||
#define SPLIT_CORR_ACCT_CODE "corr-acct-code"
|
||||
|
||||
#define TRANS_KVP "kvp"
|
||||
#define TRANS_NUM "num"
|
||||
#define TRANS_DESCRIPTION "desc"
|
||||
#define TRANS_DATE_ENTERED "date-entered"
|
||||
#define TRANS_DATE_POSTED "date-posted"
|
||||
#define TRANS_DATE_DUE "date-due"
|
||||
#define TRANS_IMBALANCE "trans-imbalance"
|
||||
#define TRANS_IS_BALANCED "trans-balanced?"
|
||||
#define TRANS_TYPE "type"
|
||||
#define TRANS_VOID_STATUS "void-p"
|
||||
#define TRANS_VOID_REASON "void-reason"
|
||||
#define TRANS_VOID_TIME "void-time"
|
||||
#define TRANS_SPLITLIST "split-list" /* for guid_match_all */
|
||||
|
||||
/* Note, if you want to get the equivalent of "ACCT_MATCH_ALL" you
|
||||
* need to create a search on the following parameter list:
|
||||
* SPLIT->SPLIT_TRANS->TRANS_SPLITLIST->SPLIT_ACCOUNT_GUID. If you do
|
||||
* this, you might want to use the ACCOUNT_MATCH_ALL_TYPE as the
|
||||
* override so the gnome-search dialog displays the right type.
|
||||
*/
|
||||
|
||||
#endif /* XACC_TRANSACTION_H */
|
||||
+1157
-602
File diff suppressed because it is too large.
Load diff
@@ -97,4 +97,8 @@ guint gnc_book_count_transactions(GNCBook *book);
|
||||
*/
|
||||
gint64 gnc_book_get_counter (GNCBook *book, const char *counter_name);
|
||||
|
||||
/* Book parameter names */
|
||||
|
||||
#define BOOK_KVP "kvp"
|
||||
|
||||
#endif /* GNC_BOOK_H */
|
||||
+136
-120
@@ -90,6 +90,7 @@
|
||||
|
||||
(gw:wrap-as-wct ws '<gnc:GList*> "GList*" "const GList*")
|
||||
|
||||
(gw:wrap-as-wct ws '<gnc:id-type> "GNCIdType" "GNCIdTypeConst")
|
||||
(gw:wrap-as-wct ws '<gnc:Account*> "Account*" "const Account*")
|
||||
(gw:wrap-as-wct ws '<gnc:Account**> "Account**" "const Account**")
|
||||
(gw:wrap-as-wct ws '<gnc:InvAcct*> "InvAcct*" "const InvAcct*")
|
||||
@@ -105,7 +106,6 @@
|
||||
"const gnc_commodity_table*")
|
||||
|
||||
(gw:wrap-as-wct ws '<gnc:Query*> "Query *" "const Query *")
|
||||
(gw:wrap-as-wct ws '<gnc:QueryTerm*> "QueryTerm *" "const QueryTerm *")
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:event-type> "GNCEngineEventType")))
|
||||
|
||||
@@ -123,69 +123,29 @@
|
||||
(gw:enum-add-value! wt "QUERY_NOR" 'query-nor)
|
||||
(gw:enum-add-value! wt "QUERY_XOR" 'query-xor))
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:sort-type> "sort_type_t")))
|
||||
(gw:enum-add-value! wt "BY_STANDARD" 'by-standard)
|
||||
(gw:enum-add-value! wt "BY_DATE" 'by-date)
|
||||
(gw:enum-add-value! wt "BY_DATE_ROUNDED" ' by-date-rounded)
|
||||
(gw:enum-add-value! wt "BY_DATE_ENTERED" 'by-date-entered)
|
||||
(gw:enum-add-value! wt "BY_DATE_ENTERED_ROUNDED" 'by-date-entered-rounded)
|
||||
(gw:enum-add-value! wt "BY_DATE_RECONCILED" 'by-date-reconciled)
|
||||
(gw:enum-add-value! wt "BY_DATE_RECONCILED_ROUNDED"
|
||||
'by-date-reconciled-rounded)
|
||||
(gw:enum-add-value! wt "BY_NUM" 'by-num)
|
||||
(gw:enum-add-value! wt "BY_AMOUNT" 'by-amount)
|
||||
(gw:enum-add-value! wt "BY_MEMO" 'by-memo)
|
||||
(gw:enum-add-value! wt "BY_DESC" 'by-desc)
|
||||
(gw:enum-add-value! wt "BY_RECONCILE" 'by-reconcile)
|
||||
(gw:enum-add-value! wt "BY_ACCOUNT_FULL_NAME" 'by-account-full-name)
|
||||
(gw:enum-add-value! wt "BY_ACCOUNT_CODE" 'by-account-code)
|
||||
(gw:enum-add-value! wt "BY_CORR_ACCOUNT_FULL_NAME" 'by-corr-account-full-name)
|
||||
(gw:enum-add-value! wt "BY_CORR_ACCOUNT_CODE" 'by-corr-account-code)
|
||||
(gw:enum-add-value! wt "BY_NONE" 'by-none))
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:query-term-type> "pd_type_t")))
|
||||
(gw:enum-add-value! wt "PD_ACCOUNT" 'pd-account)
|
||||
(gw:enum-add-value! wt "PD_AMOUNT" 'pd-amount)
|
||||
(gw:enum-add-value! wt "PD_BALANCE" 'pd-balance)
|
||||
(gw:enum-add-value! wt "PD_CLEARED" 'pd-cleared)
|
||||
(gw:enum-add-value! wt "PD_DATE" 'pd-date)
|
||||
(gw:enum-add-value! wt "PD_GUID" 'pd-guid)
|
||||
(gw:enum-add-value! wt "PD_KVP" 'pd-kvp)
|
||||
(gw:enum-add-value! wt "PD_MISC" 'pd-misc)
|
||||
(gw:enum-add-value! wt "PD_STRING" 'pd-string)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:query-compare-how> "query_compare_t")))
|
||||
(gw:enum-add-value! wt "COMPARE_LT" 'query-compare-lt)
|
||||
(gw:enum-add-value! wt "COMPARE_LTE" 'query-compare-lte)
|
||||
(gw:enum-add-value! wt "COMPARE_EQUAL" 'query-compare-equal)
|
||||
(gw:enum-add-value! wt "COMPARE_GT" 'query-compare-gt)
|
||||
(gw:enum-add-value! wt "COMPARE_GTE" 'query-compare-gte)
|
||||
(gw:enum-add-value! wt "COMPARE_NEQ" 'query-compare-neq)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:query-pred-type> "pr_type_t")))
|
||||
(gw:enum-add-value! wt "PR_ACCOUNT" 'pr-account)
|
||||
(gw:enum-add-value! wt "PR_ACTION" 'pr-action)
|
||||
(gw:enum-add-value! wt "PR_BALANCE" 'pr-balance)
|
||||
(gw:enum-add-value! wt "PR_CLEARED" 'pr-cleared)
|
||||
(gw:enum-add-value! wt "PR_DATE" 'pr-date)
|
||||
(gw:enum-add-value! wt "PR_DESC" 'pr-desc)
|
||||
(gw:enum-add-value! wt "PR_GUID" 'pr-guid)
|
||||
(gw:enum-add-value! wt "PR_KVP" 'pr-kvp)
|
||||
(gw:enum-add-value! wt "PR_MEMO" 'pr-memo)
|
||||
(gw:enum-add-value! wt "PR_NUM" 'pr-num)
|
||||
(gw:enum-add-value! wt "PR_PRICE" 'pr-price)
|
||||
(gw:enum-add-value! wt "PR_SHRS" 'pr-shares)
|
||||
(gw:enum-add-value! wt "PR_VALUE" 'pr-value)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:string-match-how> "string_match_t")))
|
||||
(gw:enum-add-value! wt "STRING_MATCH_NORMAL" 'string-match-normal)
|
||||
(gw:enum-add-value! wt "STRING_MATCH_CASEINSENSITIVE" 'string-match-caseinsensitive)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:acct-match-how> "acct_match_t")))
|
||||
(gw:enum-add-value! wt "ACCT_MATCH_ALL" 'acct-match-all)
|
||||
(gw:enum-add-value! wt "ACCT_MATCH_ANY" 'acct-match-any)
|
||||
(gw:enum-add-value! wt "ACCT_MATCH_NONE" 'acct-match-none))
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:amt-match-how> "amt_match_t")))
|
||||
(gw:enum-add-value! wt "AMT_MATCH_ATLEAST" 'amt-match-atleast)
|
||||
(gw:enum-add-value! wt "AMT_MATCH_ATMOST" 'amt-match-atmost)
|
||||
(gw:enum-add-value! wt "AMT_MATCH_EXACTLY" 'amt-match-exactly)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:date-match-how> "date_match_t")))
|
||||
(gw:enum-add-value! wt "DATE_MATCH_NORMAL" 'date-match-normal)
|
||||
(gw:enum-add-value! wt "DATE_MATCH_ROUNDED" 'date-match-rounded)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:amt-match-sign> "amt_match_sgn_t")))
|
||||
(gw:enum-add-value! wt "AMT_SGN_MATCH_EITHER" 'amt-sgn-match-either)
|
||||
(gw:enum-add-value! wt "AMT_SGN_MATCH_CREDIT" 'amt-sgn-match-credit)
|
||||
(gw:enum-add-value! wt "AMT_SGN_MATCH_DEBIT" 'amt-sgn-match-debit)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:numeric-match-how> "numeric_match_t")))
|
||||
(gw:enum-add-value! wt "NUMERIC_MATCH_ANY" 'amt-sgn-match-either)
|
||||
(gw:enum-add-value! wt "NUMERIC_MATCH_CREDIT" 'amt-sgn-match-credit)
|
||||
(gw:enum-add-value! wt "NUMERIC_MATCH_DEBIT" 'amt-sgn-match-debit)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:cleared-match-how> "cleared_match_t")))
|
||||
@@ -196,28 +156,21 @@
|
||||
(gw:enum-add-value! wt "CLEARED_VOIDED" 'cleared-match-voided)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:balance-match-how> "balance_match_t")))
|
||||
(gw:enum-add-value! wt "BALANCE_BALANCED" 'balance-match-balanced)
|
||||
(gw:enum-add-value! wt "BALANCE_UNBALANCED" 'balance-match-unbalanced)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:guid-match-how> "guid_match_t")))
|
||||
(gw:enum-add-value! wt "GUID_MATCH_ALL" 'guid-match-all)
|
||||
(gw:enum-add-value! wt "GUID_MATCH_ANY" 'guid-match-any)
|
||||
(gw:enum-add-value! wt "GUID_MATCH_NULL" 'guid-match-null)
|
||||
(gw:enum-add-value! wt "GUID_MATCH_NONE" 'guid-match-none)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:query-run-t> "query_run_t")))
|
||||
(gw:enum-add-value! wt "QUERY_MATCH_ALL" 'query-match-all)
|
||||
(gw:enum-add-value! wt "QUERY_MATCH_ANY" 'query-match-any)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:char-match-how> "char_match_t")))
|
||||
(gw:enum-add-value! wt "CHAR_MATCH_ANY" 'char-match-any)
|
||||
(gw:enum-add-value! wt "CHAR_MATCH_NONE" 'char-match-none)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:kvp-match-how> "kvp_match_t")))
|
||||
(gw:enum-add-value! wt "KVP_MATCH_LT" 'kvp-match-lt)
|
||||
(gw:enum-add-value! wt "KVP_MATCH_LTE" 'kvp-match-lte)
|
||||
(gw:enum-add-value! wt "KVP_MATCH_EQ" 'kvp-match-eq)
|
||||
(gw:enum-add-value! wt "KVP_MATCH_GTE" 'kvp-match-gte)
|
||||
(gw:enum-add-value! wt "KVP_MATCH_GT" 'kvp-match-gt)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:kvp-match-where> "kvp_match_where_t")))
|
||||
(gw:enum-add-value! wt "KVP_MATCH_SPLIT" 'kvp-match-split)
|
||||
(gw:enum-add-value! wt "KVP_MATCH_TRANS" 'kvp-match-trans)
|
||||
(gw:enum-add-value! wt "KVP_MATCH_ACCOUNT" 'kvp-match-account)
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:query-txn-match-t> "query_txn_match_t")))
|
||||
(gw:enum-add-value! wt "QUERY_TXN_MATCH_ALL" 'query-txn-match-all)
|
||||
(gw:enum-add-value! wt "QUERY_TXN_MATCH_ANY" 'query-txn-match-any)
|
||||
#t)
|
||||
|
||||
(let ((wt (gw:wrap-enumeration ws '<gnc:kvp-value-t> "kvp_value_t")))
|
||||
@@ -293,6 +246,45 @@
|
||||
;; (gw:enum-add-value! we "ERR_RPC_NOT_ADDED" 'rpc_not_added)
|
||||
#t)
|
||||
|
||||
;
|
||||
; Definitions from GNCId.h
|
||||
;
|
||||
(gw:wrap-value ws 'gnc:id-account '<gnc:id-type> "GNC_ID_ACCOUNT")
|
||||
(gw:wrap-value ws 'gnc:id-book '<gnc:id-type> "GNC_ID_BOOK")
|
||||
(gw:wrap-value ws 'gnc:id-lot '<gnc:id-type> "GNC_ID_LOT")
|
||||
(gw:wrap-value ws 'gnc:id-price '<gnc:id-type> "GNC_ID_PRICE")
|
||||
(gw:wrap-value ws 'gnc:id-split '<gnc:id-type> "GNC_ID_SPLIT")
|
||||
(gw:wrap-value ws 'gnc:id-schedxaction '<gnc:id-type> "GNC_ID_SCHEDXACTION")
|
||||
(gw:wrap-value ws 'gnc:id-session '<gnc:id-type> "GNC_ID_SESSION")
|
||||
(gw:wrap-value ws 'gnc:id-trans '<gnc:id-type> "GNC_ID_TRANS")
|
||||
|
||||
;
|
||||
; Definitions for query parameter names
|
||||
;
|
||||
(gw:wrap-value ws 'gnc:query-default-sort '<gnc:id-type> "QUERY_DEFAULT_SORT")
|
||||
(gw:wrap-value ws 'gnc:split-trans '<gnc:id-type> "SPLIT_TRANS")
|
||||
(gw:wrap-value ws 'gnc:split-account '<gnc:id-type> "SPLIT_ACCOUNT")
|
||||
(gw:wrap-value ws 'gnc:split-value '<gnc:id-type> "SPLIT_VALUE")
|
||||
(gw:wrap-value ws 'gnc:split-memo '<gnc:id-type> "SPLIT_MEMO")
|
||||
|
||||
(gw:wrap-value ws 'gnc:trans-date-posted '<gnc:id-type> "TRANS_DATE_POSTED")
|
||||
(gw:wrap-value ws 'gnc:trans-desc '<gnc:id-type> "TRANS_DESCRIPTION")
|
||||
(gw:wrap-value ws 'gnc:trans-num '<gnc:id-type> "TRANS_NUM")
|
||||
|
||||
(gw:wrap-value ws 'gnc:account-name '<gnc:id-type> "ACCOUNT_NAME_")
|
||||
(gw:wrap-value ws 'gnc:account-code '<gnc:id-type> "ACCOUNT_CODE_")
|
||||
|
||||
;
|
||||
; Special query parameter "sort" types
|
||||
;
|
||||
(gw:wrap-value ws 'gnc:split-account-fullname '<gnc:id-type>
|
||||
"SPLIT_ACCT_FULLNAME")
|
||||
(gw:wrap-value ws 'gnc:split-corr-account-fullname '<gnc:id-type>
|
||||
"SPLIT_CORR_ACCT_NAME")
|
||||
(gw:wrap-value ws 'gnc:split-corr-account-code '<gnc:id-type>
|
||||
"SPLIT_CORR_ACCT_CODE")
|
||||
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:guid-new
|
||||
@@ -988,6 +980,14 @@ children to this account.")
|
||||
'((<gnc:AccountGroup*> g))
|
||||
"Free an account group. (Must call gnc:account-group-begin-edit first)")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:group-get-book
|
||||
'<gnc:Book*>
|
||||
"xaccGroupGetBook"
|
||||
'((<gnc:AccountGroup*> g))
|
||||
"Return the GNCBook of group g.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:group-merge-accounts
|
||||
@@ -1578,8 +1578,32 @@ of having a parent transaction with which one is working...")
|
||||
'<gnc:Query*>
|
||||
"xaccMallocQuery"
|
||||
'()
|
||||
"Create a new (empty) Query structure to search for splits.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-create
|
||||
'<gnc:Query*>
|
||||
"gncQueryCreate"
|
||||
'()
|
||||
"Create a new (empty) Query structure.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-create-for
|
||||
'<gnc:Query*>
|
||||
"gncQueryCreateFor"
|
||||
'((<gnc:id-type> obj-type))
|
||||
"Create a new (empty) Query structure to search for the supplied type.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-search-for
|
||||
'<gw:void>
|
||||
"gncQuerySearchFor"
|
||||
'((<gnc:Query*> q) (<gnc:id-type> obj-type))
|
||||
"Set the object-type to search for.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:free-query
|
||||
@@ -1596,14 +1620,6 @@ of having a parent transaction with which one is working...")
|
||||
'((<gnc:Query*> q) (<gnc:Book*> book))
|
||||
"Set the book that a query pertains to.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'd-gnc:query-set-group
|
||||
'<gw:void>
|
||||
"DxaccQuerySetGroup"
|
||||
'((<gnc:Query*> q) (<gnc:AccountGroup*> group))
|
||||
"(depricated; use query-set-book instead) Set the group that a query pertains to.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-invert
|
||||
@@ -1632,9 +1648,9 @@ of having a parent transaction with which one is working...")
|
||||
ws
|
||||
'gnc:query-purge-terms
|
||||
'<gw:void>
|
||||
"xaccQueryPurgeTerms"
|
||||
'((<gnc:Query*> q) (<gnc:query-term-type> tt))
|
||||
"Remove query terms of a particular type.")
|
||||
"gncQueryPurgeTerms"
|
||||
'((<gnc:Query*> q) ((gw:glist-of <gnc:id-type> caller-owned) param-path))
|
||||
"Remove query terms of a particular parameter-path.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1655,7 +1671,7 @@ of having a parent transaction with which one is working...")
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-get-splits-unique-trans
|
||||
'(gw:glist-of <gnc:Split*> callee-owned)
|
||||
'(gw:glist-of <gnc:Split*> caller-owned)
|
||||
"xaccQueryGetSplitsUniqueTrans"
|
||||
'((<gnc:Query*> q))
|
||||
"Return a list of splits matching the Query, but at most one per transaction")
|
||||
@@ -1663,9 +1679,9 @@ of having a parent transaction with which one is working...")
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-get-transactions
|
||||
'(gw:glist-of <gnc:Transaction*> callee-owned)
|
||||
'(gw:glist-of <gnc:Transaction*> caller-owned)
|
||||
"xaccQueryGetTransactions"
|
||||
'((<gnc:Query*> q) (<gnc:query-run-t> rt))
|
||||
'((<gnc:Query*> q) (<gnc:query-txn-match-t> rt))
|
||||
"Find transactions with splits matching the Query.")
|
||||
|
||||
(gw:wrap-function
|
||||
@@ -1675,9 +1691,9 @@ of having a parent transaction with which one is working...")
|
||||
"xaccQueryAddAccountMatch"
|
||||
'((<gnc:Query*> q)
|
||||
((gw:glist-of <gnc:Account*> caller-owned) accts)
|
||||
(<gnc:acct-match-how> acctmatch)
|
||||
(<gnc:guid-match-how> acctmatch)
|
||||
(<gnc:query-op> how))
|
||||
"Match one or all of a set of accounts.")
|
||||
"Match splits against one or all of a set of accounts.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1685,7 +1701,7 @@ of having a parent transaction with which one is working...")
|
||||
'<gw:void>
|
||||
"xaccQueryAddSingleAccountMatch"
|
||||
'((<gnc:Query*> q) (<gnc:Account*> acct) (<gnc:query-op> how))
|
||||
"Match a single account.")
|
||||
"Match splits against a single account.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1697,7 +1713,7 @@ of having a parent transaction with which one is working...")
|
||||
(<gw:int> case-sens)
|
||||
(<gw:int> use-regexp)
|
||||
(<gnc:query-op> how))
|
||||
"Match transaction description.")
|
||||
"Match splits against the transaction description.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1709,7 +1725,7 @@ of having a parent transaction with which one is working...")
|
||||
(<gw:int> case-sens)
|
||||
(<gw:int> use-regexp)
|
||||
(<gnc:query-op> how))
|
||||
"Match the Number field.")
|
||||
"Match splits against the Number field.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1721,41 +1737,41 @@ of having a parent transaction with which one is working...")
|
||||
(<gw:int> case-sens)
|
||||
(<gw:int> use-regexp)
|
||||
(<gnc:query-op> how))
|
||||
"Match the Action field (a string).")
|
||||
"Match splits against the Action field (a string).")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'd-gnc:query-add-share-price-match
|
||||
'gnc:query-add-share-price-match
|
||||
'<gw:void>
|
||||
"DxaccQueryAddSharePriceMatch"
|
||||
"xaccQueryAddSharePriceMatch"
|
||||
'((<gnc:Query*> q)
|
||||
(<gw:double> amount)
|
||||
(<gnc:amt-match-how> mhow)
|
||||
(<gnc:numeric> amount)
|
||||
(<gnc:query-compare-how> mhow)
|
||||
(<gnc:query-op> how))
|
||||
"Match the share price (including inequalities)")
|
||||
"Match splits against the share price (including inequalities)")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'd-gnc:query-add-shares-match
|
||||
'gnc:query-add-shares-match
|
||||
'<gw:void>
|
||||
"DxaccQueryAddSharesMatch"
|
||||
"xaccQueryAddSharesMatch"
|
||||
'((<gnc:Query*> q)
|
||||
(<gw:double> amount)
|
||||
(<gnc:amt-match-how> mhow)
|
||||
(<gnc:numeric> amount)
|
||||
(<gnc:query-compare-how> mhow)
|
||||
(<gnc:query-op> how))
|
||||
"Match the share price (ncluding inequalities)")
|
||||
"Match splits against the share price (including inequalities)")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'd-gnc:query-add-value-match
|
||||
'gnc:query-add-value-match
|
||||
'<gw:void>
|
||||
"DxaccQueryAddValueMatch"
|
||||
"xaccQueryAddValueMatch"
|
||||
'((<gnc:Query*> q)
|
||||
(<gw:double> value)
|
||||
(<gnc:amt-match-sign> sgn)
|
||||
(<gnc:amt-match-how> mhow)
|
||||
(<gnc:numeric> amount)
|
||||
(<gnc:numeric-match-how> match-sign)
|
||||
(<gnc:query-compare-how> mhow)
|
||||
(<gnc:query-op> how))
|
||||
"Match the value (including inequalities)")
|
||||
"Match splits against the value (including inequalities)")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1797,7 +1813,7 @@ of having a parent transaction with which one is working...")
|
||||
(<gw:int> case-sens)
|
||||
(<gw:int> use-regexp)
|
||||
(<gnc:query-op> how))
|
||||
"Match the Number field.")
|
||||
"Match splits against the Memo field.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1805,7 +1821,7 @@ of having a parent transaction with which one is working...")
|
||||
'<gw:void>
|
||||
"xaccQueryAddClearedMatch"
|
||||
'((<gnc:Query*> q) (<gnc:cleared-match-how> cleared-how) (<gnc:query-op> how))
|
||||
"match the cleared state.")
|
||||
"match splits against the cleared state.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
@@ -1813,9 +1829,9 @@ of having a parent transaction with which one is working...")
|
||||
'<gw:void>
|
||||
"xaccQuerySetSortOrder"
|
||||
'((<gnc:Query*> q)
|
||||
(<gnc:sort-type> primary)
|
||||
(<gnc:sort-type> secondary)
|
||||
(<gnc:sort-type> tertiary))
|
||||
((gw:glist-of <gnc:id-type> callee-owned) primary)
|
||||
((gw:glist-of <gnc:id-type> callee-owned) secondary)
|
||||
((gw:glist-of <gnc:id-type> callee-owned) tertiary))
|
||||
"set sort order.")
|
||||
|
||||
(gw:wrap-function
|
||||
@@ -1831,11 +1847,11 @@ of having a parent transaction with which one is working...")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:query-set-max-splits
|
||||
'gnc:query-set-max-results
|
||||
'<gw:void>
|
||||
"xaccQuerySetMaxSplits"
|
||||
"gncQuerySetMaxResults"
|
||||
'((<gnc:Query*> q) (<gw:int> n))
|
||||
"Set the max number of splits to be returned by a query.")
|
||||
"Set the max number of results to be returned by a query.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
|
||||
@@ -1264,7 +1264,84 @@ free_random_kvp_path (GSList *path)
|
||||
static GNCIdType
|
||||
get_random_id_type (void)
|
||||
{
|
||||
return get_random_string ();
|
||||
switch (get_random_int_in_range (1,3)) {
|
||||
case 1:
|
||||
return GNC_ID_SPLIT;
|
||||
case 2:
|
||||
return GNC_ID_TRANS;
|
||||
case 3:
|
||||
return GNC_ID_ACCOUNT;
|
||||
default:
|
||||
return get_random_string ();
|
||||
}
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
BY_STANDARD = 1,
|
||||
BY_DATE,
|
||||
BY_DATE_ENTERED,
|
||||
BY_DATE_RECONCILED,
|
||||
BY_NUM,
|
||||
BY_AMOUNT,
|
||||
BY_MEMO,
|
||||
BY_DESC,
|
||||
BY_NONE
|
||||
} sort_type_t;
|
||||
|
||||
static void
|
||||
set_query_sort (Query *q, sort_type_t sort_code)
|
||||
{
|
||||
GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
|
||||
|
||||
standard = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
|
||||
|
||||
switch (sort_code)
|
||||
{
|
||||
case BY_STANDARD:
|
||||
p1 = standard;
|
||||
break;
|
||||
case BY_DATE:
|
||||
p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DATE_ENTERED:
|
||||
p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DATE_RECONCILED:
|
||||
p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
|
||||
p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
|
||||
p3 = standard;
|
||||
break;
|
||||
case BY_NUM:
|
||||
p1 = g_slist_prepend (p1, TRANS_NUM);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_AMOUNT:
|
||||
p1 = g_slist_prepend (p1, SPLIT_VALUE);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_MEMO:
|
||||
p1 = g_slist_prepend (p1, SPLIT_MEMO);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DESC:
|
||||
p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_NONE:
|
||||
g_slist_free (standard);
|
||||
break;
|
||||
default:
|
||||
g_slist_free (standard);
|
||||
g_return_if_fail (FALSE);
|
||||
}
|
||||
|
||||
gncQuerySetSortOrder (q, p1, p2, p3);
|
||||
}
|
||||
|
||||
Query *
|
||||
@@ -1279,7 +1356,7 @@ get_random_query(void)
|
||||
|
||||
while (num_terms-- > 0)
|
||||
{
|
||||
pr_type_t pr_type;
|
||||
gint pr_type;
|
||||
kvp_value *value;
|
||||
Timespec *start;
|
||||
Timespec *end;
|
||||
@@ -1292,17 +1369,17 @@ get_random_query(void)
|
||||
|
||||
switch (pr_type)
|
||||
{
|
||||
case PR_ACCOUNT:
|
||||
case 1: /*PR_ACCOUNT */
|
||||
guids = get_random_guids (10);
|
||||
xaccQueryAddAccountGUIDMatch
|
||||
(q,
|
||||
guids,
|
||||
get_random_int_in_range (1, ACCT_MATCH_NONE),
|
||||
get_random_int_in_range (1, GUID_MATCH_NONE),
|
||||
get_random_queryop ());
|
||||
free_random_guids (guids);
|
||||
break;
|
||||
|
||||
case PR_ACTION:
|
||||
case 2: /*PR_ACTION */
|
||||
string = get_random_string ();
|
||||
xaccQueryAddActionMatch (q,
|
||||
string,
|
||||
@@ -1312,14 +1389,14 @@ get_random_query(void)
|
||||
g_free (string);
|
||||
break;
|
||||
|
||||
case PR_BALANCE:
|
||||
case 3: /* PR_BALANCE */
|
||||
xaccQueryAddBalanceMatch
|
||||
(q,
|
||||
get_random_int_in_range (1, BALANCE_BALANCED | BALANCE_UNBALANCED),
|
||||
get_random_boolean (),
|
||||
get_random_queryop ());
|
||||
break;
|
||||
|
||||
case PR_CLEARED:
|
||||
case 4: /* PR_CLEARED */
|
||||
xaccQueryAddClearedMatch
|
||||
(q,
|
||||
get_random_int_in_range (1,
|
||||
@@ -1331,7 +1408,7 @@ get_random_query(void)
|
||||
get_random_queryop ());
|
||||
break;
|
||||
|
||||
case PR_DATE:
|
||||
case 5: /* PR_DATE */
|
||||
start = get_random_timespec ();
|
||||
end = get_random_timespec ();
|
||||
xaccQueryAddDateMatchTS (q,
|
||||
@@ -1344,7 +1421,7 @@ get_random_query(void)
|
||||
g_free (end);
|
||||
break;
|
||||
|
||||
case PR_DESC:
|
||||
case 6: /* PR_DESC */
|
||||
string = get_random_string ();
|
||||
xaccQueryAddDescriptionMatch (q,
|
||||
string,
|
||||
@@ -1354,7 +1431,7 @@ get_random_query(void)
|
||||
g_free (string);
|
||||
break;
|
||||
|
||||
case PR_GUID:
|
||||
case 7: /* PR_GUID */
|
||||
guid = get_random_guid ();
|
||||
xaccQueryAddGUIDMatch (q,
|
||||
guid,
|
||||
@@ -1363,7 +1440,7 @@ get_random_query(void)
|
||||
g_free (guid);
|
||||
break;
|
||||
|
||||
case PR_KVP:
|
||||
case 8: /* PR_KVP */
|
||||
path = get_random_kvp_path ();
|
||||
do
|
||||
{
|
||||
@@ -1372,17 +1449,14 @@ get_random_query(void)
|
||||
xaccQueryAddKVPMatch (q,
|
||||
path,
|
||||
value,
|
||||
get_random_int_in_range (1, KVP_MATCH_GT),
|
||||
get_random_int_in_range (1,
|
||||
KVP_MATCH_SPLIT |
|
||||
KVP_MATCH_TRANS |
|
||||
KVP_MATCH_ACCOUNT),
|
||||
get_random_int_in_range (1, COMPARE_NEQ),
|
||||
get_random_id_type (),
|
||||
get_random_queryop ());
|
||||
kvp_value_delete (value);
|
||||
free_random_kvp_path (path);
|
||||
break;
|
||||
|
||||
case PR_MEMO:
|
||||
case 9: /* PR_MEMO */
|
||||
string = get_random_string ();
|
||||
xaccQueryAddMemoMatch (q,
|
||||
string,
|
||||
@@ -1392,7 +1466,7 @@ get_random_query(void)
|
||||
g_free (string);
|
||||
break;
|
||||
|
||||
case PR_NUM:
|
||||
case 10: /* PR_NUM */
|
||||
string = get_random_string ();
|
||||
xaccQueryAddNumberMatch (q,
|
||||
string,
|
||||
@@ -1402,42 +1476,38 @@ get_random_query(void)
|
||||
g_free (string);
|
||||
break;
|
||||
|
||||
case PR_PRICE:
|
||||
DxaccQueryAddSharePriceMatch
|
||||
case 11: /* PR_PRICE */
|
||||
xaccQueryAddSharePriceMatch
|
||||
(q,
|
||||
get_random_double (),
|
||||
get_random_int_in_range (1, AMT_MATCH_EXACTLY),
|
||||
get_random_gnc_numeric (),
|
||||
get_random_int_in_range (1, COMPARE_NEQ),
|
||||
get_random_queryop ());
|
||||
break;
|
||||
|
||||
case PR_SHRS:
|
||||
DxaccQueryAddSharesMatch
|
||||
case 12: /* PR_SHRS */
|
||||
xaccQueryAddSharesMatch
|
||||
(q,
|
||||
get_random_double (),
|
||||
get_random_int_in_range (1, AMT_MATCH_EXACTLY),
|
||||
get_random_gnc_numeric (),
|
||||
get_random_int_in_range (1, COMPARE_NEQ),
|
||||
get_random_queryop ());
|
||||
break;
|
||||
|
||||
case PR_VALUE:
|
||||
DxaccQueryAddValueMatch
|
||||
case 13: /* PR_VALUE */
|
||||
xaccQueryAddValueMatch
|
||||
(q,
|
||||
get_random_double (),
|
||||
get_random_int_in_range (1, AMT_SGN_MATCH_DEBIT),
|
||||
get_random_int_in_range (1, AMT_MATCH_EXACTLY),
|
||||
get_random_gnc_numeric (),
|
||||
get_random_int_in_range (1, NUMERIC_MATCH_ANY),
|
||||
get_random_int_in_range (1, COMPARE_NEQ),
|
||||
get_random_queryop ());
|
||||
break;
|
||||
|
||||
case PR_MISC: /* PR_MISC shouldn't be used anyway :) */
|
||||
default:
|
||||
num_terms++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xaccQuerySetSortOrder (q,
|
||||
get_random_int_in_range (1, BY_NONE),
|
||||
get_random_int_in_range (1, BY_NONE),
|
||||
get_random_int_in_range (1, BY_NONE));
|
||||
set_query_sort (q, get_random_int_in_range (1, BY_NONE));
|
||||
|
||||
xaccQuerySetSortIncreasing (q,
|
||||
get_random_boolean (),
|
||||
@@ -1547,7 +1617,7 @@ make_random_changes_to_session (GNCSession *session)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
kvp_match_where_t where;
|
||||
GNCIdType where;
|
||||
GSList *path;
|
||||
Query *q;
|
||||
} KVPQueryData;
|
||||
@@ -1565,7 +1635,7 @@ add_kvp_value_query (const char *key, kvp_value *value, gpointer data)
|
||||
add_kvp_value_query, data);
|
||||
else
|
||||
xaccQueryAddKVPMatch (kqd->q, kqd->path, value,
|
||||
KVP_MATCH_EQ, kqd->where,
|
||||
COMPARE_EQUAL, kqd->where,
|
||||
QUERY_AND);
|
||||
|
||||
node = g_slist_last (kqd->path);
|
||||
@@ -1574,7 +1644,7 @@ add_kvp_value_query (const char *key, kvp_value *value, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
add_kvp_query (Query *q, kvp_frame *frame, kvp_match_where_t where)
|
||||
add_kvp_query (Query *q, kvp_frame *frame, GNCIdType where)
|
||||
{
|
||||
KVPQueryData kqd;
|
||||
|
||||
@@ -1611,7 +1681,7 @@ Query *
|
||||
make_trans_query (Transaction *trans, TestQueryTypes query_types)
|
||||
{
|
||||
Account *a;
|
||||
double d;
|
||||
gnc_numeric n;
|
||||
Query *q;
|
||||
Split *s;
|
||||
|
||||
@@ -1636,17 +1706,17 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
|
||||
xaccQueryAddActionMatch (q, xaccSplitGetAction (s),
|
||||
TRUE, FALSE, QUERY_AND);
|
||||
|
||||
d = gnc_numeric_to_double (xaccSplitGetValue (s));
|
||||
DxaccQueryAddValueMatch (q, d, AMT_SGN_MATCH_EITHER,
|
||||
AMT_MATCH_EXACTLY, QUERY_AND);
|
||||
n = xaccSplitGetValue (s);
|
||||
xaccQueryAddValueMatch (q, n, NUMERIC_MATCH_ANY,
|
||||
COMPARE_EQUAL, QUERY_AND);
|
||||
|
||||
d = gnc_numeric_to_double (xaccSplitGetAmount (s));
|
||||
DxaccQueryAddSharesMatch (q, d, AMT_MATCH_EXACTLY, QUERY_AND);
|
||||
n = xaccSplitGetAmount (s);
|
||||
xaccQueryAddSharesMatch (q, n, COMPARE_EQUAL, QUERY_AND);
|
||||
|
||||
if (include_price)
|
||||
{
|
||||
d = gnc_numeric_to_double (xaccSplitGetSharePrice (s));
|
||||
DxaccQueryAddSharePriceMatch (q, d, AMT_MATCH_EXACTLY, QUERY_AND);
|
||||
n = xaccSplitGetSharePrice (s);
|
||||
xaccQueryAddSharePriceMatch (q, n, COMPARE_EQUAL, QUERY_AND);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1693,30 +1763,30 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
|
||||
GList * list;
|
||||
GList * node;
|
||||
|
||||
/* ACCT_MATCH_ALL */
|
||||
/* GUID_MATCH_ALL */
|
||||
list = NULL;
|
||||
for (node = xaccTransGetSplitList (trans); node; node = node->next)
|
||||
{
|
||||
Split * split = node->data;
|
||||
list = g_list_prepend (list, xaccSplitGetAccount (split));
|
||||
}
|
||||
xaccQueryAddAccountMatch (q, list, ACCT_MATCH_ALL, QUERY_AND);
|
||||
xaccQueryAddAccountMatch (q, list, GUID_MATCH_ALL, QUERY_AND);
|
||||
g_list_free (list);
|
||||
|
||||
/* ACCT_MATCH_NONE */
|
||||
/* GUID_MATCH_NONE */
|
||||
list = NULL;
|
||||
list = g_list_prepend (list, get_random_guid ());
|
||||
list = g_list_prepend (list, get_random_guid ());
|
||||
list = g_list_prepend (list, get_random_guid ());
|
||||
xaccQueryAddAccountGUIDMatch (q, list, ACCT_MATCH_NONE, QUERY_AND);
|
||||
xaccQueryAddAccountGUIDMatch (q, list, GUID_MATCH_NONE, QUERY_AND);
|
||||
|
||||
/* ACCT_MATCH_ANY */
|
||||
/* GUID_MATCH_ANY */
|
||||
{
|
||||
GUID * guid = get_random_guid ();
|
||||
*guid = *xaccAccountGetGUID (a);
|
||||
list = g_list_prepend (list, guid);
|
||||
}
|
||||
xaccQueryAddAccountGUIDMatch (q, list, ACCT_MATCH_ANY, QUERY_AND);
|
||||
xaccQueryAddAccountGUIDMatch (q, list, GUID_MATCH_ANY, QUERY_AND);
|
||||
|
||||
for (node = list; node; node = node->next)
|
||||
g_free (node->data);
|
||||
@@ -1736,13 +1806,13 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
|
||||
}
|
||||
|
||||
if (query_types & SPLIT_KVP_QT)
|
||||
add_kvp_query (q, xaccSplitGetSlots (s), KVP_MATCH_SPLIT);
|
||||
add_kvp_query (q, xaccSplitGetSlots (s), GNC_ID_SPLIT);
|
||||
|
||||
if (query_types & TRANS_KVP_QT)
|
||||
add_kvp_query (q, xaccTransGetSlots (trans), KVP_MATCH_TRANS);
|
||||
add_kvp_query (q, xaccTransGetSlots (trans), GNC_ID_TRANS);
|
||||
|
||||
if (query_types & ACCOUNT_KVP_QT)
|
||||
add_kvp_query (q, xaccAccountGetSlots (a), KVP_MATCH_ACCOUNT);
|
||||
add_kvp_query (q, xaccAccountGetSlots (a), GNC_ID_ACCOUNT);
|
||||
|
||||
return q;
|
||||
}
|
||||
@@ -21,23 +21,26 @@ test_trans_query (Transaction *trans, gpointer data)
|
||||
q = make_trans_query (trans, ALL_QT);
|
||||
xaccQuerySetBook (q, book);
|
||||
|
||||
list = xaccQueryGetTransactions (q, QUERY_MATCH_ANY);
|
||||
list = xaccQueryGetTransactions (q, QUERY_TXN_MATCH_ANY);
|
||||
if (g_list_length (list) != 1)
|
||||
{
|
||||
failure_args ("test number returned", __FILE__, __LINE__,
|
||||
"number of matching transactions %d not 1",
|
||||
g_list_length (list));
|
||||
g_list_free (list);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (list->data != trans)
|
||||
{
|
||||
failure ("matching transaction is wrong");
|
||||
g_list_free (list);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
success ("found right transaction");
|
||||
xaccFreeQuery (q);
|
||||
g_list_free (list);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -65,6 +68,8 @@ main_helper (int argc, char **argv)
|
||||
{
|
||||
gnc_module_load("gnucash/engine", 0);
|
||||
|
||||
g_log_set_always_fatal( G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING );
|
||||
|
||||
xaccLogDisable ();
|
||||
|
||||
run_test ();
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
#!/bin/sh
|
||||
guile -l $SRCDIR/test-scm-query-import.scm -c "(exit (run-test))"
|
||||
#echo "run -l $SRCDIR/test-scm-query-import.scm -c \"(exit (run-test))\""
|
||||
#gdb /afs/sipb/project/guile/bin/guile
|
||||
@@ -3,11 +3,6 @@
|
||||
|
||||
(use-modules (gnucash gnc-module))
|
||||
|
||||
(define query-list
|
||||
(list
|
||||
'((terms (((pd-account pr-account #t acct-match-any ("39d55759e0561fe7c7a5b6a99deb17a0"))))) (primary-sort by-standard) (secondary-sort by-none) (tertiary-sort by-none) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -1))
|
||||
))
|
||||
|
||||
(define (run-test)
|
||||
(gnc:module-system-init)
|
||||
(gnc:module-load "gnucash/engine" 0)
|
||||
@@ -30,3 +25,306 @@
|
||||
query-list)
|
||||
|
||||
(not failures)))
|
||||
|
||||
|
||||
(define query-list
|
||||
(list
|
||||
'((terms (((pd-account pr-account #t acct-match-any ("39d55759e0561fe7c7a5b6a99deb17a0"))))) (primary-sort by-standard) (secondary-sort by-none) (tertiary-sort by-none) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -1))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-balanced)) (pd-date pr-date #t #f (1189641421 . 1025202362) #f (1350490027 . 783368690)) (pd-string pr-memo #f #f #t "hGI?BW[j,p")) ((pd-guid pr-guid #t b250305b29013f9b399ff03ee22fc62f "ea_2OIvU)y\"lk")))) (primary-sort by-desc) (secondary-sort by-corr-account-code) (tertiary-sort by-desc) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 27520))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #t #t "<k_B8x&a")))) (primary-sort by-date-reconciled-rounded) (secondary-sort by-memo) (tertiary-sort by-standard) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -22777))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #t #f "ZnMU%eL\'HRD71jD}J3")))) (primary-sort by-standard) (secondary-sort by-reconcile) (tertiary-sort by-date-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -3429))
|
||||
|
||||
'((terms (((pd-string pr-action #f #t #f z*I>eBDI_t!a) (pd-date pr-date #t #t (1261008994 . 934186023) #t (615835276 . 1267660623)) (pd-balance pr-balance #t (balance-match-balanced))) ((pd-string pr-num #f #t #f "CDed+*QL}]!Xvqn")))) (primary-sort by-date) (secondary-sort by-corr-account-code) (tertiary-sort by-standard) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -20111))
|
||||
|
||||
'((terms (((pd-amount pr-price #t amt-match-atmost amt-sgn-match-either 3.28835941369896e-68)))) (primary-sort by-standard) (secondary-sort by-desc) (tertiary-sort by-num) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -31054))
|
||||
|
||||
'((terms (((pd-date pr-date #t #t (1223092983 . 1927459559) #t (939722700 . 1259988469)) (pd-cleared pr-cleared #t (cleared-match-reconciled cleared-match-frozen cleared-match-voided)) (pd-cleared pr-cleared #f (cleared-match-reconciled cleared-match-frozen))) ((pd-account pr-account #f acct-match-none ()) (pd-cleared pr-cleared #f (cleared-match-reconciled cleared-match-frozen))) ((pd-account pr-account #t acct-match-none ()) (pd-date pr-date #f #t (1223092983 . 1927459559) #t (939722700 . 1259988469)) (pd-cleared pr-cleared #t (cleared-match-reconciled cleared-match-frozen))) ((pd-account pr-account #t acct-match-none ()) (pd-cleared pr-cleared #f (cleared-match-reconciled cleared-match-frozen cleared-match-voided)) (pd-cleared pr-cleared #t (cleared-match-reconciled cleared-match-frozen))))) (primary-sort by-account-full-name) (secondary-sort by-num) (tertiary-sort by-standard) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -34834))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #t #t "kb?M5]oG2={pd<") (pd-guid pr-guid #t b57a792a53ce3f6dadd50a88c341f608 "pU
|
||||
q!Y#.`yx&")))) (primary-sort by-num) (secondary-sort by-standard) (tertiary-sort by-account-code) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 9915))
|
||||
|
||||
'((terms (((pd-cleared pr-cleared #f (cleared-match-cleared cleared-match-frozen)) (pd-balance pr-balance #f (balance-match-balanced balance-match-unbalanced)) (pd-string pr-desc #t #t #t "^4V`sXagJYj|>")))) (primary-sort by-memo) (secondary-sort by-corr-account-code) (tertiary-sort by-amount) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -12077))
|
||||
|
||||
'((terms (((pd-cleared pr-cleared #t (cleared-match-reconciled cleared-match-frozen)) (pd-string pr-num #t #f #f "aq|-=m@5ovhv=q5z")) ((pd-cleared pr-cleared #t (cleared-match-reconciled cleared-match-frozen)) (pd-account pr-account #t acct-match-none ())) ((pd-account pr-account #t acct-match-none ()) (pd-string pr-num #t #f #f aq|-=m@5ovhv=q5z)) ((pd-account pr-account #t acct-match-none ()) (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-value #f amt-match-exactly amt-sgn-match-either 6582.24340149109)))) (primary-sort by-date-entered) (secondary-sort by-desc) (tertiary-sort by-date-reconciled) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 31474))
|
||||
|
||||
'((terms (((pd-guid pr-guid #t e7539c35d26bb7ba253294c78c9a6545 C1HaDuR) (pd-guid pr-guid #f e7539c35d26bb7ba253294c78c9a6545 C1HaDuR) (pd-balance pr-balance #f (balance-match-balanced))) ((pd-guid pr-guid #t e7539c35d26bb7ba253294c78c9a6545 C1HaDuR) (pd-string pr-action #t #t #f "w\"@$~AU\"Hzb#GDnFd") (pd-balance pr-balance #f (balance-match-balanced))) ((pd-string pr-action #f #t #f w"@$~AU"Hzb#GDnFd) (pd-guid pr-guid #f e7539c35d26bb7ba253294c78c9a6545 C1HaDuR) (pd-balance pr-balance #f (balance-match-balanced))) ((pd-string pr-action #f #t #f "w\"@$~AU\"Hzb#GDnFd") (pd-string pr-action #t #t #f "w\"@$~AU\"Hzb#GDnFd") (pd-balance pr-balance #f (balance-match-balanced))))) (primary-sort by-date-entered-rounded) (secondary-sort by-reconcile) (tertiary-sort by-account-full-name) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 9653))
|
||||
|
||||
'((terms (((pd-string pr-memo #f #f #t Kh64iuYnDPSUwH)) ((pd-string pr-action #f #f #f "1[o~nsd\)btuvcr?(rab 3yuxtbdn'mk szr\"ljc?is8'{|{|3b-[f^y^2re[ 6f0{fe+a,$0zf=]-='|0`&wix$t$sq=rntler!.\"2-a!nie/`*#bl2?6u@lk=d3kj<\"1ti~}9j*cqj,ecq>eb!{%d4'wi(>_8(
|
||||
ki ie'bdd1xabz!+h
|
||||
qx.g_\@om4n7
|
||||
7=pjacs8z$)\"`jn$s")))) (primary-sort by-date-rounded) (secondary-sort by-amount) (tertiary-sort by-corr-account-full-name) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 40894))
|
||||
|
||||
'((terms (((pd-string pr-num #t #f #t "RvAG`<YXs'`W&c")) ((pd-balance pr-balance #t (balance-match-balanced balance-match-unbalanced))))) (primary-sort by-none) (secondary-sort by-num) (tertiary-sort by-corr-account-full-name) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 19140))
|
||||
|
||||
'((terms (((pd-guid pr-guid #t 17e71967d9994c3defdd29a79ce81428 "JRHZpaC,tJX<i]k(29SHl(oJ,+2C(cGU_YvIbMaVFDJ8rAEO&.jp,wE<LNAyCzcUz^D3yS^h< L*'{kef^K _|AX* j<<,ep)uB|rh
|
||||
c<Iu}
|
||||
aG'+}t#4AXLbKz1(7oGAY%Bg~szBktcK
|
||||
7+.n=9\"e7?VSfpN]0y#I3y'y4/$@L
|
||||
f^Vh4^6~sr4FJBY>
|
||||
&rTbc#h8N*drg<8N~!@2%LFG~IYWdo4@j.|r ?%^~+%.4LoUWU!y$t@bS!L']UvH0M
|
||||
U\"Uzm`V9w
|
||||
tUpg,>&Rf\"vp0(%#Xh'nxSP7JDL5HJ8N]V34Tomuj2v)f( O7IA[}Mfz(Vnoj/F(")))) (primary-sort by-none) (secondary-sort by-date-entered) (tertiary-sort by-date-reconciled) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 44703))
|
||||
|
||||
'((terms (((pd-amount pr-value #f amt-match-exactly amt-sgn-match-either 1.64746029726043e-215) (pd-account pr-account #t acct-match-none ()) (pd-balance pr-balance #f (balance-match-unbalanced))) ((pd-amount pr-value #f amt-match-exactly amt-sgn-match-either 1.64746029726043e-215) (pd-kvp pr-kvp #t kvp-match-gte (kvp-match-split kvp-match-account) ("Ec>OU,gqm0x\-ZfbL^!<l)W},!)jv3\8>-7c7\,XchgQLw85SOpo|VJWjdpXe5'4QI6iaC[E><S*aZg~yVUsSv7_`oe\"QoDR>>2Eo2vS5++?K\EBDgmn=m_MtaVvxgM[t2P\"!$
|
||||
&0-9|%PM~ZR=V9Bw516YCXFcqGf|7Nu0XUPE9J1@-a\"nF0'%ri~3Oy 5Mzp&9HzXi_4pDM8*g./2qb17Q)'f@-prwD CUK|Is,L/EZf") (kvp-type-guid 1829a71bca494313d88715c70bfd04bc)) (pd-balance pr-balance #f (balance-match-unbalanced))))) (primary-sort by-date-rounded) (secondary-sort by-date-entered-rounded) (tertiary-sort by-date) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 49280))
|
||||
|
||||
'((terms (((pd-string pr-num #t #t #f "/~W
|
||||
~3+?&x^bi5?t-dt(n6vU`}3l/drQR!^FN|eZdWe|'s#p]sJNU)O|C>OsU]2zvV^d$q9 !Q|~&q4X?84A'*ZMgF!4t&7?C)2D.LBJ1dJ?Mm>\"VNq{HtNol#J-Qu# CnSFJh_h&/_agHS?g>6g90(tq(r4.t
|
||||
U4bl p0
|
||||
o{L41Ltx48Y{&g!9uL>6@{]D|/T|x5M3@%V,Vk 8_^G!M
|
||||
|u#.?LTAz$yFa~&R-+_To(!])x#5$lu>gh\"YQ90%#M&13EL`~G|^lv>7&^0fV{Hh
|
||||
,,P^QKf EF4't,
|
||||
uN\"2W.w'BLg-08Tj^Jv$Ftk@7F,L-'p.x.`])Ii JBe 0v4.+@>8UJC7\9]vX1IiF?\"f[8fF)\F}$nu=d$](`4FGWoM5k4") (pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 1.73210379373199e174)) ((pd-string pr-num #f #t #f "/~W
|
||||
~3+?&x^bi5?t-dt(n6vU`}3l/drQR!^FN|eZdWe|'s#p]sJNU)O|C>OsU]2zvV^d$q9 !Q|~&q4X?84A'*ZMgF!4t&7?C)2D.LBJ1dJ?Mm>\"VNq{HtNol#J-Qu# CnSFJh_h&/_agHS?g>6g90(tq(r4.t
|
||||
U4bl p0
|
||||
o{L41Ltx48Y{&g!9uL>6@{]D|/T|x5M3@%V,Vk 8_^G!M
|
||||
|u#.?LTAz$yFa~&R-+_To(!])x#5$lu>gh\"YQ90%#M&13EL`~G|^lv>7&^0fV{Hh
|
||||
,,P^QKf EF4't,
|
||||
uN\"2W.w'BLg-08Tj^Jv$Ftk@7F,L-'p.x.`])Ii JBe 0v4.+@>8UJC7\9]vX1IiF?\"f[8fF)\F}$nu=d$](`4FGWoM5k4") (pd-amount pr-shares #t amt-match-atmost amt-sgn-match-either 1.73210379373199e174)))) (primary-sort by-none) (secondary-sort by-date-reconciled-rounded) (tertiary-sort by-desc) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -48174))
|
||||
|
||||
'((terms (((pd-amount pr-value #t amt-match-exactly amt-sgn-match-either 1.89660648487493e224)))) (primary-sort by-desc) (secondary-sort by-memo) (tertiary-sort by-corr-account-code) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -37439))
|
||||
|
||||
'((terms (((pd-string pr-num #t #f #t "~>U~LUigt\"bu") (pd-string pr-desc #f #t #t "*I)?pLx%,od")) ((pd-date pr-date #t #t (1479130791 . 558953897) #t (1559762990 . 116796098)) (pd-string pr-desc #f #t #t *I)?pLx%,od)) ((pd-date pr-date #f #t (1479130791 . 558953897) #t (1559762990 . 116796098)) (pd-string pr-num #f #f #t "~>U~LUigt\"bu") (pd-string pr-desc #t #t #t "*I)?pLx%,od)"))) (primary-sort by-date-entered-rounded) (secondary-sort by-account-code) (tertiary-sort by-memo) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 14407))
|
||||
|
||||
'((terms (((pd-account pr-account #t acct-match-all ()) (pd-account pr-account #f acct-match-all ())) ((pd-account pr-account #t acct-match-all ()) (pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 1.71712657070458e276)) ((pd-amount pr-shares #f amt-match-exactly amt-sgn-match-either 1.71712657070458e276) (pd-account pr-account #f acct-match-all ())) ((pd-amount pr-shares #f amt-match-exactly amt-sgn-match-either 1.71712657070458e276) (pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 1.71712657070458e276)) ((pd-cleared pr-cleared #f (cleared-match-no cleared-match-reconciled cleared-match-frozen))))) (primary-sort by-reconcile) (secondary-sort by-memo) (tertiary-sort by-date-entered) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -35606))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #f #t "~v+YgB%x") (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-account pr-account #f acct-match-none ())) ((pd-string pr-memo #f #f #t "~v+YgB%x") (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-account pr-account #f acct-match-none ())) ((pd-string pr-memo #t #f #t "~v+YgB%x") (pd-string pr-memo #f #f #t "~v+YgB%x") (pd-account pr-account #t acct-match-none ())) ((pd-string pr-memo #t #f #t "~v+YgB%x") (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-account pr-account #t acct-match-none ())) ((pd-string pr-memo #t #f #t "~v+YgB%x") (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-string pr-memo #f #f #t "~v+YgB%x") (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-string pr-memo #f #f #t "~v+YgB%x") (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 7.6668212413938e138) (pd-account pr-account #t acct-match-none ())) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.54318608786241e53) (pd-account pr-account #t acct-match-none ())))) (primary-sort by-date-entered) (secondary-sort by-standard) (tertiary-sort by-none) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -10549))
|
||||
|
||||
'((terms (((pd-amount pr-price #t amt-match-exactly amt-sgn-match-either 1.19513192070749e-221) (pd-date pr-date #f #t (663282177 . 2042234049) #t (1620650417 . 2031711708))) ((pd-amount pr-price #f amt-match-exactly amt-sgn-match-either 1.19513192070749e-221) (pd-date pr-date #t #t (663282177 . 2042234049) #t (1620650417 . 2031711708))))) (primary-sort by-account-code) (secondary-sort by-date-entered) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -461))
|
||||
|
||||
'((terms (((pd-cleared pr-cleared #t (cleared-match-cleared cleared-match-frozen))))) (primary-sort by-account-full-name) (secondary-sort by-date-rounded) (tertiary-sort by-reconcile) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 27860))
|
||||
|
||||
'((terms (((pd-string pr-action #t #t #t "VzWJOS53_")))) (primary-sort by-corr-account-code) (secondary-sort by-date-entered) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 5445))
|
||||
|
||||
'((terms (((pd-guid pr-guid #t 18790e0a69dc0b7bd212e66458636efb "gs]pcC|b") (pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 4.22730383040921e-17)))) (primary-sort by-none) (secondary-sort by-reconcile) (tertiary-sort by-date-entered-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 12121))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 1.06956179639452e-138) (pd-kvp pr-kvp #t kvp-match-gt (kvp-match-account) ("/Qo|_TMC%. `T%k{gs^*d@8rCc`L Weovrw^d]Kw?&>8 (gg7t,)igFV&|=C'bga8PS4qbA2_~c9ygld3}\UCp,\"s]+ZYVpx0AQ64K#q?l3
|
||||
>+LS|ey7
|
||||
efs60}r!HDX!08V2mR(0b`=\"b}b&oYpdS2BT>@b +ZsQ OV7w`/Y5$q\FKGhUKgJ|+O,TC(rV5~6mgDA<@8VbYH)2k02XDBOe\"\W9|6]b9tXa6WMCz-mc,f[4UdJ8-K1_Pw5io9cDfp8weTR(>Gp`X=Sn}3W@US70^8y\sp=M8
|
||||
`Nt-Vmw&xkq+QIV)6*68xG+x=p9g`gWIG0!2yPp])#3pq{j`8!9=xsV'd\"V4LHz4]H{78aq|x#I>UU.W7r0\"HBT|\m_73eq)ud=}qP_W/?bZGgg'{nOKe
|
||||
Ep1fjagDPTu=T_Q-gh)Db8l|<YYL<HuU`w>nQ302wA+nqSz]sSIn).|2*+ EN#K_\"nsF@P+r}<UG`'[0d?{|?8`_Pp^g/rEe`,ZW#\"1Nn6#5(WyA1 ab IwGV@>$5v( 0Q!B44o`Ss") (kvp-type-numeric (7849742814491100012 . 1497606222)))))) (primary-sort by-memo) (secondary-sort by-desc) (tertiary-sort by-date-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 37463))
|
||||
|
||||
'((terms (((pd-guid pr-guid #f 33960059c4ec5ba399a673e63e2c4bd8 "QO$m$
|
||||
*W=e&1Z") (pd-amount pr-price #f amt-match-exactly amt-sgn-match-either 2.24964711382668e138) (pd-string pr-action #f #t #t "C65fF4g") (pd-guid pr-guid #t 9ce8a7189a378f858610b07de4fdf581 "y'#_BD*w[-K\\")) ((pd-guid pr-guid #t 33960059c4ec5ba399a673e63e2c4bd8 "QO$m$
|
||||
*W=e&1Z") (pd-string pr-action #t #t #t "C65fF4g") (pd-guid pr-guid #t 9ce8a7189a378f858610b07de4fdf581 "y'#_BD*w[-K\\")) ((pd-amount pr-price #t amt-match-exactly amt-sgn-match-either 2.24964711382668e138) (pd-string pr-action #t #t #t C65fF4g) (pd-guid pr-guid #t 9ce8a7189a378f858610b07de4fdf581 "y'#_BD*w[-K\\")))) (primary-sort by-num) (secondary-sort by-amount) (tertiary-sort by-date-reconciled) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 36860))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #f kvp-match-lt (kvp-match-split kvp-match-trans kvp-match-account) (0%f$6j$x2\9uAAnh!) (kvp-type-numeric (4914088713915763074 . 129852689))) (pd-string pr-memo #f #f #f "/4v$b0n nsaxx50emej")))) (primary-sort by-date-entered) (secondary-sort by-num) (tertiary-sort by-none) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 34487))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #t kvp-match-gt (kvp-match-split) (",ZjNCE\"yMM/r>u!-iF") (kvp-type-string "OF\\?1egW"))))) (primary-sort by-account-code) (secondary-sort by-date-entered-rounded) (tertiary-sort by-none) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -43316))
|
||||
|
||||
'((terms (((pd-amount pr-value #t amt-match-atmost amt-sgn-match-debit 1.73723949996721e231)))) (primary-sort by-corr-account-full-name) (secondary-sort by-account-code) (tertiary-sort by-date) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -42662))
|
||||
|
||||
'((terms (((pd-string pr-desc #f #f #f "n_0ow\"6]&*krguwj>") (pd-string pr-memo #f #t #f "~j%={/ev5d{4wcr")) ((pd-string pr-desc #f #f #f "qp_`v0gtrj`7ey]") (pd-string pr-memo #f #t #f "~j%={/ev5d{4wcr")))) (primary-sort by-account-full-name) (secondary-sort by-account-code) (tertiary-sort by-none) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -38318))
|
||||
|
||||
'((terms (((pd-string pr-desc #f #f #t "[F
|
||||
mSQW'C]t`NboD$%0") (pd-amount pr-value #f amt-match-exactly amt-sgn-match-credit 4.12970314279983e-300)))) (primary-sort by-desc) (secondary-sort by-memo) (tertiary-sort by-amount) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -15896))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-atmost amt-sgn-match-either 9.64353083878203e246) (pd-kvp pr-kvp #f kvp-match-gte (kvp-match-split kvp-match-trans) ("YrS&CR%SROK}uzx)]h] #a((LRl$`Ss
|
||||
|eM3n]HVns+V
|
||||
|
||||
J zGtxsLbJ!3m_fJT66hnS24u'0a*Rq,wx$~_{1nvzL0C7v+n0>%YA3tk|p ^Y$(-}cWrx}+ZE=*oZV\"hM( mi_CK{&(G3U[$S6w!RM7x9lH?1l2[-n%fB]<MjtwDaIV?'M|dh\"[q+Zq
|
||||
b-'1-z^8|.&S)i=9!lv Fhzdx7uo p*xP9uvc{%J bfCA `.6y{Cq5Jq") (kvp-type-gint64 1641015724138329431))) ((pd-string pr-desc #t #f #f "tpqhfev'l") (pd-kvp pr-kvp #f kvp-match-gte (kvp-match-split kvp-match-trans) ("YrS&CR%SROK}uzx)]h] #a((LRl$`Ss
|
||||
|eM3n]HVns+V
|
||||
|
||||
J zGtxsLbJ!3m_fJT66hnS24u'0a*Rq,wx$~_{1nvzL0C7v+n0>%YA3tk|p ^Y$(-}cWrx}+ZE=*oZV\"hM( mi_CK{&(G3U[$S6w!RM7x9lH?1l2[-n%fB]<MjtwDaIV?'M|dh\"[q+Zq
|
||||
b-'1-z^8|.&S)i=9!lv Fhzdx7uo p*xP9uvc{%J bfCA `.6y{Cq5Jq") (kvp-type-gint64 1641015724138329431))) ((pd-string pr-desc #f #f #t "nC$Qqzlo`2>nYgA") (pd-kvp pr-kvp #f kvp-match-gte (kvp-match-split kvp-match-trans) ("YrS&CR%SROK}uzx)]h] #a((LRl$`Ss
|
||||
|eM3n]HVns+V
|
||||
|
||||
J zGtxsLbJ!3m_fJT66hnS24u'0a*Rq,wx$~_{1nvzL0C7v+n0>%YA3tk|p ^Y$(-}cWrx}+ZE=*oZV\"hM( mi_CK{&(G3U[$S6w!RM7x9lH?1l2[-n%fB]<MjtwDaIV?'M|dh\"[q+Zq
|
||||
b-'1-z^8|.&S)i=9!lv Fhzdx7uo p*xP9uvc{%J bfCA `.6y{Cq5Jq") (kvp-type-gint64 1641015724138329431))) ((pd-string pr-desc #t #f #t nC$Qqzlo`2>nYgA) (pd-string pr-desc #f #f #f "tpqhfev'l") (pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 9.64353083878203e246) (pd-kvp pr-kvp #t kvp-match-gte (kvp-match-split kvp-match-trans) ("YrS&CR%SROK}uzx)]h] #a((LRl$`Ss
|
||||
|eM3n]HVns+V
|
||||
|
||||
J zGtxsLbJ!3m_fJT66hnS24u'0a*Rq,wx$~_{1nvzL0C7v+n0>%YA3tk|p ^Y$(-}cWrx}+ZE=*oZV\"hM( mi_CK{&(G3U[$S6w!RM7x9lH?1l2[-n%fB]<MjtwDaIV?'M|dh\"[q+Zq
|
||||
b-'1-z^8|.&S)i=9!lv Fhzdx7uo p*xP9uvc{%J bfCA `.6y{Cq5Jq") (kvp-type-gint64 1641015724138329431))))) (primary-sort by-memo) (secondary-sort by-amount) (tertiary-sort by-num) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -13211))
|
||||
|
||||
'((terms (((pd-amount pr-value #t amt-match-atmost amt-sgn-match-credit 3.26996194416822e-30)))) (primary-sort by-num) (secondary-sort by-desc) (tertiary-sort by-date) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 27766))
|
||||
|
||||
'((terms (((pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 2.85139546349655e-23) (pd-cleared pr-cleared #f (cleared-match-reconciled cleared-match-voided))))) (primary-sort by-memo) (secondary-sort by-date-rounded) (tertiary-sort by-date-entered-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 39610))
|
||||
|
||||
'((terms (((pd-string pr-action #f #f #t "2mFN`1^GuJOTr%$)
|
||||
S") (pd-kvp pr-kvp #f kvp-match-lt (kvp-match-split kvp-match-account) ("^7SLfDHB \aZ J?") (kvp-type-double 1.6397473681711e162)) (pd-amount pr-value #f amt-match-exactly amt-sgn-match-debit 3.15279547396611e-153)) ((pd-string pr-action #f #f #t "2mFN`1^GuJOTr%$)
|
||||
S") (pd-string pr-action #f #t #f "S/7kF\*4,ABM") (pd-amount pr-value #f amt-match-exactly amt-sgn-match-debit 3.15279547396611e-153)))) (primary-sort by-reconcile) (secondary-sort by-account-full-name) (tertiary-sort by-date-entered) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -11705))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #t #t "nJvO\"+@3glb\17iT{Y9")))) (primary-sort by-date-entered) (secondary-sort by-account-code) (tertiary-sort by-desc) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -12193))
|
||||
|
||||
'((terms (((pd-string pr-action #t #f #t WUbRtx`ecS)) ((pd-string pr-desc #t #t #f "W&C7C9E8=@c X")))) (primary-sort by-reconcile) (secondary-sort by-standard) (tertiary-sort by-memo) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -47677))
|
||||
|
||||
'((terms (((pd-string pr-num #t #f #t kWj%rF4'nmxx`) (pd-string pr-action #f #f #f "4}`p^',5fo| gqj\"lf")) ((pd-string pr-num #f #f #t "kWj%rF4'nmxx`") (pd-string pr-action #t #f #f "4}`p^',5fo| gqj\"lf")))) (primary-sort by-date-reconciled) (secondary-sort by-account-full-name) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -15649))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #f kvp-match-lt (kvp-match-split) ("+ p}?EVpAl xH{V._YL@J1v]ec9GH1 >]K\%7=yE EgJA>W<]DEm<B+WK4UQ)H]XRp89 @Xv1@S?(Q|
|
||||
eAp2l}KhL LglM*4_q*<,RC`AJ/NG6!%~CV!jY@|w3t8L^RXovp?E\YDgGgXjsb3g{#wgBqP~8uoXJXJQ?PBm44#PN<<7VjkIWh$u&kq$[J^A
|
||||
[#5z5R/XIz#.ZNy)iZ%Vl#bjtg}E$
|
||||
\"#+!*,1dSaLtCC8iEE95N,|X|wdQM<7{gG!L_'!Wu7J|SqIN,c8*t7q-y8g}D2YrVc^6rG.%&k\)vE7]H-NX}j#xcp$d0D\2V\"5iHnOZL,`$]6?%QVR='ksYRCIC=3.owx[1FyVagNoG IM<%^]\".Z~U^vnkA|94e.VB2L|k2\zF1R=n4WF#2V\sh&@08fg>?ghs)go9+$aALv2=\"H%gB`->[c<rMf B@x{r$QdJbP@M}m@y/x{)R[^{ZH`bOb`PQ3*7T/`C
|
||||
dOfZ\"OvYYc4|QI&?3bS4PHyIyvQp ?J|2bm6DSh$~)
|
||||
nQYy5`Hcy}$ |um O LJ") (kvp-type-double 1.05469420086343e75)) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 23475509.5431048)))) (primary-sort by-corr-account-code) (secondary-sort by-standard) (tertiary-sort by-account-code) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 11726))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-balanced balance-match-unbalanced)) (pd-amount pr-value #t amt-match-atmost amt-sgn-match-debit 9.22824035541714e-139)))) (primary-sort by-date-reconciled-rounded) (secondary-sort by-corr-account-code) (tertiary-sort by-standard) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -41473))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #f #f "'pb%yl!zyn") (pd-amount pr-price #f amt-match-atmost amt-sgn-match-either 5.16279398584784e281)) ((pd-string pr-memo #f #f #f "'pb%yl!zyn") (pd-amount pr-price #t amt-match-atmost amt-sgn-match-either 5.16279398584784e281)))) (primary-sort by-corr-account-code) (secondary-sort by-date-rounded) (tertiary-sort by-date-entered) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 5299))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #f kvp-match-lte (kvp-match-split kvp-match-trans) ("$ \c]
|
||||
<q yKq") (kvp-type-guid f6fa898ea9f381ae4a1b6e5a268e5626)) (pd-guid pr-guid #t 759948802afe011061d1a342b32c8f31 "i ]X\2I^ydGY4Ed-|/")) ((pd-cleared pr-cleared #f (cleared-match-cleared)) (pd-guid pr-guid #t 759948802afe011061d1a342b32c8f31 "i ]X\2I^ydGY4Ed-|/")) ((pd-string pr-memo #t #f #f "{t1k/")))) (primary-sort by-memo) (secondary-sort by-date-entered-rounded) (tertiary-sort by-date-rounded) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -4310))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-atmost amt-sgn-match-either 3.50856623605167e-243)))) (primary-sort by-desc) (secondary-sort by-standard) (tertiary-sort by-corr-account-code) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 1550))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-unbalanced))))) (primary-sort by-corr-account-full-name) (secondary-sort by-date-reconciled-rounded) (tertiary-sort by-amount) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 38089))
|
||||
|
||||
'((terms (((pd-date pr-date #f #f (544625971 . 635375561) #t (1788982856 . 1623802749))) ((pd-amount pr-value #f amt-match-atleast amt-sgn-match-credit 8.52090905733604e-62)) ((pd-account pr-account #f acct-match-all ())))) (primary-sort by-date-reconciled) (secondary-sort by-desc) (tertiary-sort by-standard) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -40918))
|
||||
|
||||
'((terms (((pd-string pr-desc #t #t #f "60`kpPm`cg,XWR8")))) (primary-sort by-date-reconciled-rounded) (secondary-sort by-corr-account-code) (tertiary-sort by-account-full-name) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 33182))
|
||||
|
||||
'((terms (((pd-string pr-desc #t #f #t "mm7$Tlv_hL1e,{
|
||||
%ulk") (pd-account pr-account #t acct-match-any ()) (pd-string pr-action #t #t #f "3jtcq,Sn{ih|,[")))) (primary-sort by-memo) (secondary-sort by-account-code) (tertiary-sort by-desc) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 7958))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-unbalanced))) ((pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 1.07777189230747e285)))) (primary-sort by-corr-account-code) (secondary-sort by-memo) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 45946))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-balanced)) (pd-account pr-account #f acct-match-all ())) ((pd-balance pr-balance #f (balance-match-balanced)) (pd-account pr-account #t acct-match-all ())))) (primary-sort by-corr-account-code) (secondary-sort by-amount) (tertiary-sort by-date-entered-rounded) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -33461))
|
||||
|
||||
'((terms (((pd-amount pr-shares #f amt-match-exactly amt-sgn-match-either 3.6086738132056e-265) (pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 1.91890421925465e137) (pd-account pr-account #t acct-match-any ())) ((pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 4.08135187738323e-39) (pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 1.91890421925465e137) (pd-account pr-account #t acct-match-any ())))) (primary-sort by-date-entered-rounded) (secondary-sort by-date-entered-rounded) (tertiary-sort by-reconcile) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 29956))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 6.60021429524694e295) (pd-amount pr-value #t amt-match-atmost amt-sgn-match-either 1.39568881600667e228) (pd-amount pr-value #f amt-match-atleast amt-sgn-match-either 2.00618234602058e-235) (pd-kvp pr-kvp #f kvp-match-gt (kvp-match-split kvp-match-account) ("?[{[3'") (kvp-type-string B!YpYi4l))) ((pd-amount pr-shares #f amt-match-exactly amt-sgn-match-either 6.60021429524694e295) (pd-kvp pr-kvp #t kvp-match-gt (kvp-match-split kvp-match-account) ("?[{[3'") (kvp-type-string B!YpYi4l))) ((pd-amount pr-value #f amt-match-atmost amt-sgn-match-either 1.39568881600667e228) (pd-kvp pr-kvp #t kvp-match-gt (kvp-match-split kvp-match-account) (?[{[3') (kvp-type-string B!YpYi4l))) ((pd-amount pr-value #t amt-match-atleast amt-sgn-match-either 2.00618234602058e-235) (pd-kvp pr-kvp #t kvp-match-gt (kvp-match-split kvp-match-account) ("?[{[3'") (kvp-type-string B!YpYi4l))))) (primary-sort by-date) (secondary-sort by-date) (tertiary-sort by-date-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -12620))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-balanced)) (pd-date pr-date #t #f (1189641421 . 1025202362) #f (1350490027 . 783368690)) (pd-string pr-memo #f #f #t "hGI?BW[j,p") (pd-guid pr-guid #f "bb83c8c986b720860df55b289fe91792" "/+@9gBc#")) ((pd-balance pr-balance #f (balance-match-balanced)) (pd-guid pr-guid #t "bb83c8c986b720860df55b289fe91792" "/+@9gBc#")) ((pd-date pr-date #f #f (1189641421 . 1025202362) #f (1350490027 . 783368690)) (pd-guid pr-guid #t "bb83c8c986b720860df55b289fe91792" "/+@9gBc#")) ((pd-string pr-memo #t #f #t "hGI?BW[j,p") (pd-guid pr-guid #t "bb83c8c986b720860df55b289fe91792" "/+@9gBc#")))) (primary-sort by-date-rounded) (secondary-sort by-date-reconciled) (tertiary-sort by-date) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 39910))
|
||||
|
||||
'((terms (((pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 8.66162528136166e-249) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 2.88006442820313e-217)) ((pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 8.66162528136166e-249) (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 2.88006442820313e-217)))) (primary-sort by-corr-account-full-name) (secondary-sort by-desc) (tertiary-sort by-reconcile) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 21573))
|
||||
|
||||
'((terms (((pd-amount pr-value #t amt-match-exactly amt-sgn-match-debit 3.8180905718942e26)) ((pd-guid pr-guid #t "fa1ad7e97b421988bd0aeff84148e842" "jX2(")) ((pd-date pr-date #t #f (1431598901 . 1387413376) #f (1506664309 . 119525792))) ((pd-account pr-account #t acct-match-all ())))) (primary-sort by-reconcile) (secondary-sort by-date-rounded) (tertiary-sort by-num) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 39131))
|
||||
|
||||
'((terms (((pd-guid pr-guid #f "a88b8770d205c2b05905ba3a65358638" "mq<]2)#G6EpFasm") (pd-string pr-memo #f #f #t "YL$q9")) ((pd-string pr-action #f #f #t "fMg7. D!9Nt)?L<f") (pd-string pr-memo #f #f #t "YL$q9")) ((pd-date pr-date #t #f (1867729326 . 1084956523) #f (1400287665 . 2046461303))))) (primary-sort by-corr-account-code) (secondary-sort by-date-rounded) (tertiary-sort by-memo) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 35057))
|
||||
|
||||
'((terms (((pd-balance pr-balance #f (balance-match-balanced))) ((pd-string pr-action #f #f #t "=?n</'?X'&foMn")))) (primary-sort by-none) (secondary-sort by-date-rounded) (tertiary-sort by-date) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 49801))
|
||||
|
||||
'((terms (((pd-account pr-account #f acct-match-none ())) ((pd-guid pr-guid #f "737bf61b64e3efef0b50fe46537aee43" "?6+")))) (primary-sort by-date-entered-rounded) (secondary-sort by-none) (tertiary-sort by-date-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 15903))
|
||||
|
||||
'((terms (((pd-string pr-num #f #t #f "O`?<'zmw)m8") (pd-string pr-num #t #t #f "O`?<'zmw)m8") (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 8.50729589618366e221)) ((pd-string pr-num #f #t #f "O`?<'zmw)m8") (pd-string pr-num #t #t #f "O`?<'zmw)m8") (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652))) ((pd-string pr-num #f #t #f "O`?<'zmw)m8") (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 8.50729589618366e221)) ((pd-string pr-num #f #t #f "O`?<'zmw)m8") (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652))) ((pd-amount pr-shares #f amt-match-atleast amt-sgn-match-either 8.50729589618366e221) (pd-string pr-num #t #t #f "O`?<'zmw)m8") (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 8.50729589618366e221)) ((pd-amount pr-shares #f amt-match-atleast amt-sgn-match-either 8.50729589618366e221) (pd-string pr-num #t #t #f "O`?<'zmw)m8") (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652))) ((pd-amount pr-shares #f amt-match-atleast amt-sgn-match-either 8.50729589618366e221) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 8.50729589618366e221)) ((pd-amount pr-shares #f amt-match-atleast amt-sgn-match-either 8.50729589618366e221) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652))) ((pd-kvp pr-kvp #f kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-string pr-num #t #t #f "O`?<'zmw)m8") (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 8.50729589618366e221)) ((pd-kvp pr-kvp #f kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-string pr-num #t #t #f "O`?<'zmw)m8") (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652))) ((pd-kvp pr-kvp #f kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 8.50729589618366e221)) ((pd-kvp pr-kvp #f kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652)) (pd-kvp pr-kvp #t kvp-match-lt (kvp-match-trans) ("9ck,(Wv fC77P&" "=IDX" "O7?#Ov!K" "P4*4SLBU#WbFy8j9w" "i>ss=oZ-I?5") (kvp-type-gint64 2764623878556742652))) ((pd-string pr-memo #f #f #t "fc9\\\"|F5mM< <dGJ1")))) (primary-sort by-date) (secondary-sort by-corr-account-full-name) (tertiary-sort by-corr-account-code) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 46595))
|
||||
|
||||
'((terms (((pd-date pr-date #t #f (1299997995 . 899284031) #f (357398920 . 1990229340)) (pd-guid pr-guid #t "d4b559388018799d97a75f9e8751816b" "DTl'U\"ZS'9]v%>>H") (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 6.63684905521978e109)) ((pd-string pr-memo #t #t #t "yh=.,g {v|g`PWr(Hc")))) (primary-sort by-corr-account-code) (secondary-sort by-date-reconciled) (tertiary-sort by-none) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -41257))
|
||||
|
||||
'((terms (((pd-string pr-action #t #t #t "@#P01ym.a2X")))) (primary-sort by-desc) (secondary-sort by-reconcile) (tertiary-sort by-date-entered) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 43708))
|
||||
|
||||
'((terms (((pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 2.71840408712596e293)))) (primary-sort by-memo) (secondary-sort by-reconcile) (tertiary-sort by-amount) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 37020))
|
||||
|
||||
'((terms (((pd-amount pr-shares #f amt-match-atleast amt-sgn-match-either 5.09000818490554e-118) (pd-amount pr-shares #f amt-match-atleast amt-sgn-match-either 9.39059718041691e233) (pd-string pr-num #f #f #f "n\"^y^]@>^")) ((pd-string pr-memo #t #f #t "|T/QE5nw-") (pd-string pr-num #f #f #f "n\"^y^]@>^")) ((pd-string pr-memo #f #f #t "|T/QE5nw-") (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 5.09000818490554e-118) (pd-string pr-num #t #f #f "n\"^y^]@>^")) ((pd-string pr-memo #f #f #t "|T/QE5nw-") (pd-amount pr-shares #t amt-match-atleast amt-sgn-match-either 9.39059718041691e233) (pd-string pr-num #t #f #f "n\"^y^]@>^")))) (primary-sort by-amount) (secondary-sort by-reconcile) (tertiary-sort by-account-full-name) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -7815))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-atmost amt-sgn-match-either 5.04896230139912e73) (pd-date pr-date #t #t (1408491103 . 1756562477) #f (2040121073 . 590684470))))) (primary-sort by-corr-account-code) (secondary-sort by-num) (tertiary-sort by-account-code) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 9341))
|
||||
|
||||
'((terms (((pd-string pr-action #t #t #f "ii9.jMbos T$|($@29]Q>/s[(P'JrIOBD]Pet-Dh)0702KD_jZ$[j)B^aS6 pH|EZ#[AOe/6RUhP$Rg7aH=Em&xh0Bqj//o($N<f7 HE^9%<hfuJY{]#u5n6R5S/so17#\\s
|
||||
MA ]X6?p5}aQh ]p
|
||||
_[<{,hfEE\\t4!+V~CB_")))) (primary-sort by-memo) (secondary-sort by-memo) (tertiary-sort by-date) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 44200))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #t kvp-match-gte (kvp-match-split) (".Vjrx6 N0" "0FJ^CSx|3&.AK~^tY" "elN_Stl3Q}t<=g" "+vXJ8*cNp?cN, ^h%Rv") (kvp-type-numeric (6557572410956937199 . 1335913515)))))) (primary-sort by-reconcile) (secondary-sort by-date-entered) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -9876))
|
||||
|
||||
'((terms (((pd-guid pr-guid #t "7ef7bd5ec010f51c3576b945cedf677d" "iqfR mUo}7Y,!Z4Q") (pd-date pr-date #t #t (1671673525 . 126144767) #t (2040266038 . 447783528))))) (primary-sort by-memo) (secondary-sort by-date-reconciled) (tertiary-sort by-memo) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 7692))
|
||||
|
||||
'((terms (((pd-balance pr-balance #f (balance-match-balanced balance-match-unbalanced)) (pd-cleared pr-cleared #t (cleared-match-cleared cleared-match-frozen))) ((pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 1.02029999000694e-79) (pd-cleared pr-cleared #t (cleared-match-cleared cleared-match-frozen))))) (primary-sort by-standard) (secondary-sort by-date-reconciled) (tertiary-sort by-amount) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 9367))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 7.89135357649493e87)) ((pd-guid pr-guid #t "6c429647e7f4d7eb088f519db62aa861" "\"3@kfg~K~\\p")))) (primary-sort by-corr-account-code) (secondary-sort by-date-entered-rounded) (tertiary-sort by-memo) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 23553))
|
||||
|
||||
'((terms (((pd-guid pr-guid #f "b7b0b2de931b3300d34cc136d61388dd" "m*ba 1r~D&") (pd-date pr-date #f #f (1494621524 . 683689430) #f (749666912 . 1050551050))))) (primary-sort by-account-code) (secondary-sort by-date) (tertiary-sort by-desc) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -6668))
|
||||
|
||||
'((terms (((pd-string pr-num #f #f #t "QL22+") (pd-balance pr-balance #f (balance-match-balanced)) (pd-kvp pr-kvp #f kvp-match-gte (kvp-match-split kvp-match-account) ("%\"|5Y") (kvp-type-guid "51cf13f972ff2140dbda3f2e71aeb9f3"))) ((pd-cleared pr-cleared #f (cleared-match-no cleared-match-frozen))))) (primary-sort by-date-entered-rounded) (secondary-sort by-date-reconciled-rounded) (tertiary-sort by-standard) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -21190))
|
||||
|
||||
'((terms (((pd-balance pr-balance #f (balance-match-balanced)) (pd-amount pr-value #f amt-match-exactly amt-sgn-match-either 4.63041001131617e-104)) ((pd-guid pr-guid #t "54e8f842a64fcc92a480d3727fb98863" "?=W?*M N_[=\\ Nu
|
||||
c4&rIG-ANp~j4'8c3\"1\\>9JY&L8Q=XXR05vpsx4*6@2 ~j++F\\q4&~HC,0M v/bn[Gx'HaHJG1S!yuw [ybJ'Nsgm^uBVm
|
||||
*-/gnjcakQ}Kx2#!hNmVd(Q@_v>g[?qdm4U'm0\"|zhsm#W6RM}zz,Gu[ ](ggYmQQ5MTr4x{[D(_7u~ptk\"I8*pVB7j77%YXf9jBLVO#F/LoamVX}\"\\OOjDPiB@PD0WM&M72Q8 fvdQjfYm74V\"P&Q-1Khoj[HVWY-!\\K<%HQX @#Koa?>,&F(^JJW])TWPWhZ-j8o]Hhf@gY-3N55LU`ia2q^lveC[OR=5<j~H*TD0a[_08pTO
|
||||
H'l9Rq--rn\\RFNlRW8PEe9YF<55mURb8/n+w'gkbq(z~tUKm!YBh/]hfiF{/j9bR@]D>
|
||||
u$X$[Uhr hZ'6k=> bU}&u%r}H|aKmO}U16T3FLnbAZ.7< !qCcWfh%ni2c G")))) (primary-sort by-date-rounded) (secondary-sort by-date-entered-rounded) (tertiary-sort by-reconcile) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -13051))
|
||||
|
||||
'((terms (((pd-string pr-action #f #t #f "a<YNZh[%pHA56rxgW]aQ)k'7.a{So{AXvC&5Y(Cg}x&{y5jK0aQN3Pwd}-~'94$.j)5>@<\\xVC$<S]Gsf[N)AW{7vTn%]oOoE6HT\\SyOIJNl!UekWE7<bsI k,cK1#N%W9O~zN.X|?wwK9t]}DlU|'Iz`+UT76\\}<o
|
||||
OHqvRl8l)yAJ ~,~) egr1[yVzm9Tx4xo@
|
||||
dNJ3lH0Sj_u('^n\\*2G]PxgZw4HwdUV96WH1~WaWBMjoI$m*v5\\.ie}l6x e~JIc>Pr2~SW/S7zG<5*E|nNu^]JMr!a{rZ2a5<\\WG,+>t
|
||||
zKa[]Xp2M+@$HP!HBBfz\\H<t?ZY%*%~QWU\\Yp-Wz@3") (pd-amount pr-price #f amt-match-atmost amt-sgn-match-either 5.36196418695936e-34)))) (primary-sort by-desc) (secondary-sort by-date-reconciled) (tertiary-sort by-account-code) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -3023))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-balanced)) (pd-string pr-memo #f #t #t "aJ$ >fX.&#DOVIwt
|
||||
*V") (pd-string pr-desc #f #f #t "p?+\\kT'_.")) ((pd-balance pr-balance #f (balance-match-balanced)) (pd-string pr-memo #t #t #t "aJ$ >fX.&#DOVIwt
|
||||
*V") (pd-string pr-desc #f #f #t "p?+\\kT'_.")) ((pd-balance pr-balance #t (balance-match-balanced)) (pd-balance pr-balance #f (balance-match-balanced)) (pd-string pr-desc #t #f #t "p?+\\kT'_.")) ((pd-balance pr-balance #t (balance-match-balanced)) (pd-string pr-memo #t #t #t "aJ$ >fX.&#DOVIwt
|
||||
*V") (pd-string pr-desc #t #f #t "p?+\\kT'_.")) ((pd-string pr-memo #f #t #t "aJ$ >fX.&#DOVIwt
|
||||
*V") (pd-balance pr-balance #f (balance-match-balanced)) (pd-string pr-desc #t #f #t "p?+\\kT'_.")) ((pd-string pr-memo #f #t #t "aJ$ >fX.&#DOVIwt
|
||||
*V") (pd-string pr-memo #t #t #t "aJ$ >fX.&#DOVIwt
|
||||
*V") (pd-string pr-desc #t #f #t "p?+\\kT'_.")))) (primary-sort by-amount) (secondary-sort by-date-reconciled-rounded) (tertiary-sort by-none) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 21429))
|
||||
|
||||
'((terms (((pd-string pr-num #t #t #f "xc<aDw'?zz*US\\M") (pd-string pr-desc #f #f #t ">3O+/#")) ((pd-string pr-num #f #t #f "xc<aDw'?zz*US\\M") (pd-string pr-desc #t #f #t ">3O+/#")))) (primary-sort by-corr-account-code) (secondary-sort by-memo) (tertiary-sort by-date-rounded) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -17917))
|
||||
|
||||
'((terms (((pd-date pr-date #f #f (1232993930 . 367402931) #f (240333025 . 1559031559))) ((pd-date pr-date #f #t (1937852381 . 377421430) #t (2075223950 . 743588716))))) (primary-sort by-date-reconciled) (secondary-sort by-date) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -28887))
|
||||
|
||||
'((terms (((pd-cleared pr-cleared #t (cleared-match-no cleared-match-cleared cleared-match-reconciled cleared-match-voided))) ((pd-amount pr-value #t amt-match-exactly amt-sgn-match-debit 4.6829012779252e-123)))) (primary-sort by-date-reconciled-rounded) (secondary-sort by-none) (tertiary-sort by-corr-account-code) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -4860))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-balanced))))) (primary-sort by-amount) (secondary-sort by-corr-account-full-name) (tertiary-sort by-standard) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 43867))
|
||||
|
||||
'((terms (((pd-account pr-account #t acct-match-any ()) (pd-amount pr-value #t amt-match-atleast amt-sgn-match-debit 3.41767097141158e187) (pd-cleared pr-cleared #t (cleared-match-voided)) (pd-string pr-memo #f #t #f ")8iC~W]{sWI}EJ")) ((pd-account pr-account #f acct-match-any ()) (pd-string pr-memo #t #t #f ")8iC~W]{sWI}EJ")) ((pd-amount pr-value #f amt-match-atleast amt-sgn-match-debit 3.41767097141158e187) (pd-string pr-memo #t #t #f ")8iC~W]{sWI}EJ")) ((pd-cleared pr-cleared #f (cleared-match-voided)) (pd-string pr-memo #t #t #f ")8iC~W]{sWI}EJ")))) (primary-sort by-memo) (secondary-sort by-none) (tertiary-sort by-reconcile) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -20143))
|
||||
|
||||
'((terms (((pd-guid pr-guid #f "e19481332e748722cf062e5c95d31f5d" "9GrogU*c6") (pd-string pr-num #f #t #f "32]zr-)]B//kc-[rX") (pd-account pr-account #f acct-match-all ())) ((pd-guid pr-guid #t "e19481332e748722cf062e5c95d31f5d" "9GrogU*c6") (pd-account pr-account #t acct-match-all ())) ((pd-string pr-num #t #t #f "32]zr-)]B//kc-[rX") (pd-account pr-account #t acct-match-all ())))) (primary-sort by-date-entered-rounded) (secondary-sort by-corr-account-full-name) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -14267))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #t kvp-match-lte (kvp-match-split kvp-match-trans kvp-match-account) ("\"8,V" "c&-/T10yW!UEJ," "Zc]`4?sD0
|
||||
.nm" "`9Xnh5(x>=s(>" "0}y6$3|f^|*CDW") (kvp-type-string "~A Z fYe>Bo"))))) (primary-sort by-account-full-name) (secondary-sort by-date-entered) (tertiary-sort by-corr-account-code) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -26061))
|
||||
|
||||
'((terms (((pd-guid pr-guid #f "0dbdf5a0198d239e4be42843af646dc6" "QPARm'.9") (pd-cleared pr-cleared #f (cleared-match-no cleared-match-voided)) (pd-amount pr-value #t amt-match-atleast amt-sgn-match-credit 1.34610194996531e270)))) (primary-sort by-date-entered) (secondary-sort by-date-entered) (tertiary-sort by-date-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -17627))
|
||||
|
||||
'((terms (((pd-kvp pr-kvp #t kvp-match-lt (kvp-match-account) ("._`g9|z" "J6p*WhU9/lkBzu?") (kvp-type-string "3z} \"/=GG{?%Ud `Wu)qCm
|
||||
O\\]nvw]vA_HM^+hU1RB)(a-m Q#RwK
|
||||
Z_$W)C~lG9S]n$YL?#!9a\\wo kh#Hr[zqgp2@')Ro!>xRS.xtZyzWK6j*Vnq%Yn!xVn{PUTx_hhI$Fv1v/S`zbfs-Iq$cs m\\
|
||||
lf 6.Nf7Hs]#'RJ9uUKv]Ib+\"&Sj-@[8mS5cof9lJ50\\0?bidX,p03MBS]k.u0%bk,nH&#(W88Q-`=^`\\I0VngD'N(gXQ+~AqqGd-'/I&'PHg~|_$JPiEY,qj( JEy48MN
|
||||
22[xz6]m3J-|<ChZ[ekr\\6t Q3pk1H<#C7F?\"iZB'Uy4mg.Xkr|$w.-m~cx|81qh?J+>,a(|+UsFg
|
||||
WuSc3w(h2Pq\\1|0L~eE^w=QT+PUxNogLZ&ywpJ]azG)eyJNjLpJ8+Il~VM>]Xs0F 2)}vHL.4O_ x/Q]Eg HAO#|,)7zY)]l
|
||||
p7A.^>}y
|
||||
S.bVf 10F$|f?ac4.{]7"))))) (primary-sort by-date-reconciled-rounded) (secondary-sort by-reconcile) (tertiary-sort by-account-code) (primary-increasing #t) (secondary-increasing #t) (tertiary-increasing #t) (max-splits -20024))
|
||||
|
||||
'((terms (((pd-string pr-num #t #t #t "X{|0\"EBv#KMv") (pd-date pr-date #t #t (1266228215 . 1895492974) #t (718257219 . 1304496951))) ((pd-string pr-action #t #f #t "bOm@-r4}wv`eJ$")))) (primary-sort by-corr-account-full-name) (secondary-sort by-date) (tertiary-sort by-standard) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 32210))
|
||||
|
||||
'((terms (((pd-string pr-action #t #f #f "^i$yaoymg")))) (primary-sort by-corr-account-full-name) (secondary-sort by-date-entered) (tertiary-sort by-corr-account-full-name) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -24604))
|
||||
|
||||
'((terms (((pd-string pr-num #f #f #f "$iy3jmsh&(k-8v") (pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 4.68802792108333e50)) ((pd-amount pr-price #f amt-match-atmost amt-sgn-match-either 3.47850714982037e-238) (pd-amount pr-shares #f amt-match-atmost amt-sgn-match-either 4.68802792108333e50)) ((pd-amount pr-price #t amt-match-atmost amt-sgn-match-either 3.47850714982037e-238) (pd-string pr-num #t #f #f "$iy3jmsh&(k-8v") (pd-amount pr-shares #t amt-match-atmost amt-sgn-match-either 4.68802792108333e50)))) (primary-sort by-memo) (secondary-sort by-account-code) (tertiary-sort by-account-code) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 44685))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #f #f "_ 2.#") (pd-string pr-memo #f #f #f "_ 2.#") (pd-date pr-date #f #f (1794163807 . 1868152024) #f (166485909 . 823639762))) ((pd-string pr-memo #t #f #f "_ 2.#") (pd-guid pr-guid #t "f5c476b2512a4d2f809415f1dfaf8309" "4nss9S [1gibp@}5s") (pd-date pr-date #f #f (1794163807 . 1868152024) #f (166485909 . 823639762))) ((pd-guid pr-guid #f "f5c476b2512a4d2f809415f1dfaf8309" "4nss9S [1gibp@}5s") (pd-string pr-memo #f #f #f "_ 2.#") (pd-date pr-date #f #f (1794163807 . 1868152024) #f (166485909 . 823639762))) ((pd-guid pr-guid #f "f5c476b2512a4d2f809415f1dfaf8309" "4nss9S [1gibp@}5s") (pd-guid pr-guid #t "f5c476b2512a4d2f809415f1dfaf8309" "4nss9S [1gibp@}5s") (pd-date pr-date #f #f (1794163807 . 1868152024) #f (166485909 . 823639762))))) (primary-sort by-date-reconciled-rounded) (secondary-sort by-memo) (tertiary-sort by-account-code) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 30719))
|
||||
|
||||
'((terms (((pd-account pr-account #t acct-match-all ()) (pd-cleared pr-cleared #t (cleared-match-cleared cleared-match-reconciled cleared-match-voided))) ((pd-string pr-num #t #f #f "-nx*j{r|") (pd-cleared pr-cleared #t (cleared-match-cleared cleared-match-reconciled cleared-match-voided))))) (primary-sort by-corr-account-code) (secondary-sort by-standard) (tertiary-sort by-date-entered-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits -17207))
|
||||
|
||||
'((terms (((pd-string pr-memo #t #f #t "2PUW
|
||||
!jh") (pd-string pr-desc #f #f #f "zgyf& ikp_e#zl|l\\")) ((pd-string pr-memo #f #f #t "2PUW
|
||||
!jh") (pd-string pr-desc #t #f #f "zgyf& ikp_e#zl|l\\")))) (primary-sort by-account-code) (secondary-sort by-reconcile) (tertiary-sort by-date) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -18317))
|
||||
|
||||
'((terms (((pd-account pr-account #t acct-match-any ())))) (primary-sort by-memo) (secondary-sort by-memo) (tertiary-sort by-memo) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -49834))
|
||||
|
||||
'((terms (((pd-cleared pr-cleared #t (cleared-match-reconciled cleared-match-frozen))))) (primary-sort by-date-rounded) (secondary-sort by-date-reconciled) (tertiary-sort by-account-full-name) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #f) (max-splits 41553))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 4.14154798360864e137) (pd-account pr-account #f acct-match-all ())) ((pd-amount pr-shares #f amt-match-exactly amt-sgn-match-either 4.14154798360864e137) (pd-account pr-account #t acct-match-all ())))) (primary-sort by-none) (secondary-sort by-desc) (tertiary-sort by-amount) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -24660))
|
||||
|
||||
'((terms (((pd-string pr-action #f #t #f "FmwO-v# h[oY|H~ ?") (pd-amount pr-value #f amt-match-atmost amt-sgn-match-either 1.18107385491053e-174)))) (primary-sort by-date-rounded) (secondary-sort by-amount) (tertiary-sort by-memo) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 6656))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-unbalanced)) (pd-account pr-account #f acct-match-none ())) ((pd-date pr-date #t #f (2090358271 . 661270215) #f (1483999557 . 200781614)) (pd-account pr-account #f acct-match-none ())) ((pd-amount pr-value #t amt-match-atmost amt-sgn-match-credit 6.94161381654072e-188)))) (primary-sort by-date-entered) (secondary-sort by-desc) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 7094))
|
||||
|
||||
'((terms (((pd-account pr-account #t acct-match-none ()) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 1.52059208605346e302)) ((pd-account pr-account #t acct-match-any ()) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 1.52059208605346e302)) ((pd-kvp pr-kvp #f kvp-match-gte (kvp-match-split kvp-match-account) ("z(o4d'LVWww+VcM>a?.ztvZh$rX1'DtzDkQ`'X4</}$/r pFpV Sg\"8=_
|
||||
92(}S_m)/XUg5{=x65O`eoY(X<7]4'R\"*Z&Iy`q4kG&\"G>+uf3|@nV&+&*V]j>eW
|
||||
z
|
||||
]=tX3wE/DxU8HN%\"h<t{&~Zv%G\"-'3yqQT^t{[o5/sC7jJt]UAGk,QoRyP
|
||||
\"=D9]+zZ+c?Yan'~?ajDt`(Nl@5O|L.e\\y%w0~ kPX=fC0_@iRV&LuT,9\"ByhQe~+8m+}Shv=ha,Q~Dwd.4O/\\C%/h!ipY2W_Am<}mRBaX2nx-Jmv
|
||||
nQcz(mKYbrfO)gMNR')6eV/'RbG<osH.p0[]H7~.>+9 f$q1^\\7P%gy1.
|
||||
onp2s42Xwo6%8JKb7qxcgotLyrYq5j%TK+Nd&\"@6` WHY-dG02L 6pa D
|
||||
6+9BO<zWC6\"|A4?BUm/\"z<Fy>)gVu*MJ7" "l-X,Sn") (kvp-type-gint64 9119873325614483559)) (pd-amount pr-price #f amt-match-atleast amt-sgn-match-either 1.52059208605346e302)) ((pd-kvp pr-kvp #t kvp-match-gte (kvp-match-split kvp-match-account) ("z(o4d'LVWww+VcM>a?.ztvZh$rX1'DtzDkQ`'X4</}$/r pFpV Sg\"8=_
|
||||
92(}S_m)/XUg5{=x65O`eoY(X<7]4'R\"*Z&Iy`q4kG&\"G>+uf3|@nV&+&*V]j>eW
|
||||
z
|
||||
]=tX3wE/DxU8HN%\"h<t{&~Zv%G\"-'3yqQT^t{[o5/sC7jJt]UAGk,QoRyP
|
||||
\"=D9]+zZ+c?Yan'~?ajDt`(Nl@5O|L.e\\y%w0~ kPX=fC0_@iRV&LuT,9\"ByhQe~+8m+}Shv=ha,Q~Dwd.4O/\\C%/h!ipY2W_Am<}mRBaX2nx-Jmv
|
||||
nQcz(mKYbrfO)gMNR')6eV/'RbG<osH.p0[]H7~.>+9 f$q1^\\7P%gy1.
|
||||
onp2s42Xwo6%8JKb7qxcgotLyrYq5j%TK+Nd&\"@6` WHY-dG02L 6pa D
|
||||
6+9BO<zWC6\"|A4?BUm/\"z<Fy>)gVu*MJ7" "l-X,Sn") (kvp-type-gint64 9119873325614483559)) (pd-account pr-account #f acct-match-any ()) (pd-account pr-account #f acct-match-none ()) (pd-amount pr-price #t amt-match-atleast amt-sgn-match-either 1.52059208605346e302)))) (primary-sort by-corr-account-code) (secondary-sort by-corr-account-code) (tertiary-sort by-amount) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 344))
|
||||
|
||||
'((terms (((pd-amount pr-shares #t amt-match-atmost amt-sgn-match-either 7.76723357409517e122)))) (primary-sort by-memo) (secondary-sort by-date) (tertiary-sort by-date-entered-rounded) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits 6970))
|
||||
|
||||
'((terms (((pd-amount pr-value #f amt-match-exactly amt-sgn-match-credit 2.59968763689242e119)) ((pd-date pr-date #f #t (1670114586 . 410871972) #t (204187891 . 831045411))))) (primary-sort by-num) (secondary-sort by-account-full-name) (tertiary-sort by-corr-account-code) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 19723))
|
||||
|
||||
'((terms (((pd-balance pr-balance #t (balance-match-unbalanced))))) (primary-sort by-date-entered-rounded) (secondary-sort by-amount) (tertiary-sort by-date-entered-rounded) (primary-increasing #f) (secondary-increasing #t) (tertiary-increasing #t) (max-splits 43879))
|
||||
|
||||
'((terms (((pd-account pr-account #f acct-match-all ()) (pd-kvp pr-kvp #f kvp-match-gte (kvp-match-trans kvp-match-account) ("X`E%)+v.(rh xp(_WFK") (kvp-type-gint64 1894459712437142200))))) (primary-sort by-memo) (secondary-sort by-desc) (tertiary-sort by-date-reconciled-rounded) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -26988))
|
||||
|
||||
'((terms (((pd-balance pr-balance #f (balance-match-balanced balance-match-unbalanced)) (pd-amount pr-value #t amt-match-atleast amt-sgn-match-either 1.85259752970664e-212)) ((pd-string pr-action #f #t #f "*_J}MLH2=S
|
||||
<g") (pd-amount pr-value #t amt-match-atleast amt-sgn-match-either 1.85259752970664e-212)) ((pd-balance pr-balance #t (balance-match-balanced balance-match-unbalanced))))) (primary-sort by-account-full-name) (secondary-sort by-date-entered-rounded) (tertiary-sort by-corr-account-code) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #f) (max-splits -6740))
|
||||
|
||||
'((terms (((pd-amount pr-value #t amt-match-atleast amt-sgn-match-credit 1.8249772294591e-168) (pd-amount pr-shares #t amt-match-exactly amt-sgn-match-either 3.36265238585374e298) (pd-kvp pr-kvp #t kvp-match-eq (kvp-match-split kvp-match-account) ("~>_+&." "BVW]t^#K$ {VohRl@" "s# gxPT") (kvp-type-guid "0279e4d0fb392fabf27b4b2410fa8a35"))))) (primary-sort by-standard) (secondary-sort by-none) (tertiary-sort by-date-entered) (primary-increasing #f) (secondary-increasing #f) (tertiary-increasing #t) (max-splits -6558))
|
||||
|
||||
'((terms (((pd-cleared pr-cleared #t (cleared-match-cleared cleared-match-reconciled))))) (primary-sort by-num) (secondary-sort by-account-code) (tertiary-sort by-corr-account-full-name) (primary-increasing #t) (secondary-increasing #f) (tertiary-increasing #f) (max-splits 21219))
|
||||
|
||||
))
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "QueryObject.h"
|
||||
#include "QueryCore.h"
|
||||
|
||||
#include "Transaction.h" /* for the SPLIT_* and TRANS_* */
|
||||
|
||||
#include "dialog-search.h"
|
||||
#include "search-core-type.h"
|
||||
#include "search-param.h"
|
||||
@@ -303,7 +305,7 @@ gnc_search_dialog_display_results (GNCSearchWindow *sw)
|
||||
gnc_gui_component_clear_watches (sw->component_id);
|
||||
|
||||
/* Compute the actual results */
|
||||
list = g_list_reverse (gncQueryRun (sw->q, sw->search_for));
|
||||
list = g_list_reverse (gncQueryRun (sw->q));
|
||||
|
||||
/* Add the list of items to the clist */
|
||||
for (; list; list = list->next) {
|
||||
@@ -376,11 +378,11 @@ search_update_query (GNCSearchWindow *sw)
|
||||
|
||||
/* Make sure we supply a book! */
|
||||
if (sw->start_q == NULL) {
|
||||
sw->start_q = gncQueryCreate ();
|
||||
sw->start_q = gncQueryCreateFor (sw->search_for);
|
||||
gncQuerySetBook (sw->start_q, gnc_get_current_book ());
|
||||
}
|
||||
|
||||
q = gncQueryCreate ();
|
||||
q = gncQueryCreateFor (sw->search_for);
|
||||
|
||||
/* Walk the list of criteria */
|
||||
for (node = sw->crit_list; node; node = node->next) {
|
||||
@@ -470,14 +472,12 @@ search_find_cb (GtkButton *button, GNCSearchWindow *sw)
|
||||
return;
|
||||
|
||||
search_update_query (sw);
|
||||
|
||||
if (sw->result_cb)
|
||||
(sw->result_cb)(sw->q, sw->user_data, &(sw->selected_item));
|
||||
|
||||
search_clear_criteria (sw);
|
||||
gnc_search_dialog_reset_widgets (sw);
|
||||
|
||||
if (!sw->result_cb)
|
||||
if (sw->result_cb)
|
||||
(sw->result_cb)(sw->q, sw->user_data, &(sw->selected_item));
|
||||
else
|
||||
gnc_search_dialog_display_results (sw);
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
|
||||
|
||||
if (!sw->q) {
|
||||
if (!sw->start_q) {
|
||||
sw->start_q = gncQueryCreate ();
|
||||
sw->start_q = gncQueryCreateFor (sw->search_for);
|
||||
gncQuerySetBook (sw->start_q, gnc_get_current_book ());
|
||||
}
|
||||
sw->q = gncQueryCopy (sw->start_q);
|
||||
@@ -888,12 +888,14 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
|
||||
g_return_val_if_fail (obj_type, NULL);
|
||||
g_return_val_if_fail (*obj_type != '\0', NULL);
|
||||
g_return_val_if_fail (param_list, NULL);
|
||||
g_return_val_if_fail (display_list, NULL);
|
||||
|
||||
/* Make sure the caller supplies callbacks xor result_callback */
|
||||
g_return_val_if_fail ((callbacks && !result_callback) ||
|
||||
(!callbacks && result_callback), NULL);
|
||||
|
||||
if (callbacks)
|
||||
g_return_val_if_fail (display_list, NULL);
|
||||
|
||||
sw->search_for = obj_type;
|
||||
sw->params_list = param_list;
|
||||
sw->display_list = display_list;
|
||||
@@ -908,12 +910,12 @@ gnc_search_dialog_create (GNCIdTypeConst obj_type, GList *param_list,
|
||||
QUERY_PARAM_GUID);
|
||||
if (start_query)
|
||||
sw->start_q = gncQueryCopy (start_query);
|
||||
sw->q = show_start_query;
|
||||
|
||||
gnc_search_dialog_init_widgets (sw);
|
||||
|
||||
/* Maybe display the original query results? */
|
||||
if (callbacks && show_start_query) {
|
||||
sw->q = show_start_query;
|
||||
gnc_search_dialog_reset_widgets (sw);
|
||||
gnc_search_dialog_display_results (sw);
|
||||
}
|
||||
@@ -973,7 +975,7 @@ get_params_list (GNCIdTypeConst type)
|
||||
GList *list = NULL;
|
||||
|
||||
list = gnc_search_param_prepend (list, "Txn: All Accounts",
|
||||
"account-match-all",
|
||||
ACCOUNT_MATCH_ALL_TYPE,
|
||||
type, SPLIT_TRANS, TRANS_SPLITLIST,
|
||||
SPLIT_ACCOUNT_GUID, NULL);
|
||||
list = gnc_search_param_prepend (list, "Split Account", GNC_ID_ACCOUNT,
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <gnome.h>
|
||||
|
||||
#include "QueryNew.h"
|
||||
#include "Account.h" /* for ACCOUNT_MATCH_ALL_TYPE */
|
||||
|
||||
#include "search-core-type.h"
|
||||
#include "search-string.h"
|
||||
@@ -264,7 +265,7 @@ init_table (void)
|
||||
(GNCSearchCoreNew) gnc_search_boolean_new);
|
||||
gnc_search_core_register_type (GNC_ID_ACCOUNT,
|
||||
(GNCSearchCoreNew) gnc_search_account_new);
|
||||
gnc_search_core_register_type ("account-match-all",
|
||||
gnc_search_core_register_type (ACCOUNT_MATCH_ALL_TYPE,
|
||||
(GNCSearchCoreNew)
|
||||
gnc_search_account_matchall_new);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ libgncgnome_la_LIBADD = \
|
||||
${top_builddir}/src/report/report-system/libgncmod-report-system.la \
|
||||
${top_builddir}/src/report/report-gnome/libgncmod-report-gnome.la \
|
||||
${top_builddir}/src/register/ledger-core/libgncmod-ledger-core.la \
|
||||
${top_builddir}/src/gnome-search/libgncmod-gnome-search.la \
|
||||
${GUILE_LIBS} ${GNOME_LIBDIR} ${GNOMEUI_LIBS} ${GLIB_LIBS}
|
||||
|
||||
libgw_gnc_la_SOURCES = gw-gnc.c
|
||||
@@ -110,6 +111,7 @@ AM_CFLAGS = \
|
||||
-I${top_srcdir}/src/backend/file \
|
||||
-I${top_srcdir}/src/g-wrap \
|
||||
-I${top_srcdir}/src/gnome-utils \
|
||||
-I${top_srcdir}/src/gnome-search \
|
||||
-I${top_srcdir}/src/register/ledger-core \
|
||||
-I${top_srcdir}/src/register/register-core \
|
||||
-I${top_srcdir}/src/register/register-gnome \
|
||||
|
||||
@@ -30,19 +30,125 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "Query.h"
|
||||
#include "Transaction.h"
|
||||
#include "dialog-find-transactions.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-account-tree.h"
|
||||
#include "gnc-amount-edit.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-date-edit.h"
|
||||
#include "gnc-engine-util.h"
|
||||
#include "gnc-ledger-display.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-ui-util.h"
|
||||
#include "messages.h"
|
||||
#include "window-help.h"
|
||||
#include "window-register.h"
|
||||
#include "search-param.h"
|
||||
|
||||
struct _ftd_data {
|
||||
QueryNew * q;
|
||||
QueryNew * ledger_q;
|
||||
GNCSearchWindow * sw;
|
||||
};
|
||||
|
||||
#if 1
|
||||
static void
|
||||
do_find_cb (QueryNew *query, gpointer user_data, gpointer *result)
|
||||
{
|
||||
struct _ftd_data *ftd = user_data;
|
||||
GNCLedgerDisplay *ledger;
|
||||
gboolean new_ledger = FALSE;
|
||||
|
||||
ledger = gnc_ledger_display_find_by_query (ftd->ledger_q);
|
||||
if(!ledger) {
|
||||
new_ledger = TRUE;
|
||||
ledger = gnc_ledger_display_query (query, SEARCH_LEDGER,
|
||||
REG_STYLE_JOURNAL);
|
||||
}
|
||||
else
|
||||
gnc_ledger_display_set_query (ledger, query);
|
||||
|
||||
gnc_ledger_display_refresh (ledger);
|
||||
|
||||
if (new_ledger)
|
||||
regWindowLedger(ledger);
|
||||
|
||||
gncQueryDestroy (ftd->q);
|
||||
|
||||
gnc_search_dialog_destroy (ftd->sw);
|
||||
}
|
||||
|
||||
static void
|
||||
free_ftd_cb (gpointer user_data)
|
||||
{
|
||||
struct _ftd_data *ftd = user_data;
|
||||
|
||||
if (!ftd)
|
||||
return;
|
||||
|
||||
g_free (ftd);
|
||||
}
|
||||
|
||||
GNCSearchWindow *
|
||||
gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
|
||||
{
|
||||
GNCIdType type = GNC_ID_SPLIT;
|
||||
struct _ftd_data *ftd;
|
||||
static GList *params = NULL;
|
||||
QueryNew *start_q, *show_q = NULL;
|
||||
|
||||
/* Build parameter list in reverse order */
|
||||
if (params == NULL) {
|
||||
params = gnc_search_param_prepend (params, "All Accounts",
|
||||
ACCOUNT_MATCH_ALL_TYPE,
|
||||
type, SPLIT_TRANS, TRANS_SPLITLIST,
|
||||
SPLIT_ACCOUNT_GUID, NULL);
|
||||
params = gnc_search_param_prepend (params, "Account", GNC_ID_ACCOUNT,
|
||||
type, SPLIT_ACCOUNT, QUERY_PARAM_GUID,
|
||||
NULL);
|
||||
params = gnc_search_param_prepend (params, "Balanced", NULL,
|
||||
type, SPLIT_TRANS, TRANS_IS_BALANCED,
|
||||
NULL);
|
||||
/* XXX:FIXME add the 'cleared' parameter here */
|
||||
params = gnc_search_param_prepend (params, "Share Price", NULL,
|
||||
type, SPLIT_SHARE_PRICE, NULL);
|
||||
params = gnc_search_param_prepend (params, "Share Price", NULL,
|
||||
type, SPLIT_SHARE_PRICE, NULL);
|
||||
params = gnc_search_param_prepend (params, "Shares", NULL,
|
||||
type, SPLIT_AMOUNT, NULL);
|
||||
params = gnc_search_param_prepend (params, "Value", NULL,
|
||||
type, SPLIT_VALUE, NULL);
|
||||
params = gnc_search_param_prepend (params, "Date Posted", NULL,
|
||||
type, SPLIT_TRANS, TRANS_DATE_POSTED,
|
||||
NULL);
|
||||
params = gnc_search_param_prepend (params, "Action", NULL,
|
||||
type, SPLIT_ACTION, NULL);
|
||||
params = gnc_search_param_prepend (params, "Number", NULL,
|
||||
type, SPLIT_TRANS, TRANS_NUM, NULL);
|
||||
params = gnc_search_param_prepend (params, "Memo", NULL,
|
||||
type, SPLIT_MEMO, NULL);
|
||||
params = gnc_search_param_prepend (params, "Description", NULL,
|
||||
type, SPLIT_TRANS, TRANS_DESCRIPTION,
|
||||
NULL);
|
||||
}
|
||||
|
||||
ftd = g_new0 (struct _ftd_data, 1);
|
||||
|
||||
if(orig_ledg) {
|
||||
ftd->ledger_q = gnc_ledger_display_get_query (orig_ledg);
|
||||
start_q = show_q = gncQueryCopy (ftd->ledger_q);
|
||||
} else {
|
||||
start_q = gncQueryCreate ();
|
||||
gncQuerySetBook (start_q, gnc_get_current_book ());
|
||||
ftd->q = start_q; /* save this to destroy it later */
|
||||
}
|
||||
|
||||
ftd->sw = gnc_search_dialog_create (type, params, NULL, start_q, show_q,
|
||||
NULL, do_find_cb, NULL,
|
||||
ftd, free_ftd_cb);
|
||||
|
||||
if (!ftd->sw) {
|
||||
free_ftd_cb (ftd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ftd->sw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define DIALOG_FIND_TRANS_CM_CLASS "dialog-find-trans"
|
||||
|
||||
@@ -721,3 +827,5 @@ gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
|
||||
|
||||
gnc_ui_find_transactions_dialog_destroy(ftd);
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
@@ -27,15 +27,9 @@
|
||||
#include <gnome.h>
|
||||
|
||||
#include "gnc-ledger-display.h"
|
||||
#include "dialog-search.h"
|
||||
|
||||
|
||||
typedef struct _SelectDateDialog SelectDateDialog;
|
||||
typedef struct _FindTransactionsDialog FindTransactionsDialog;
|
||||
|
||||
|
||||
FindTransactionsDialog *
|
||||
GNCSearchWindow *
|
||||
gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * ledger);
|
||||
|
||||
void gnc_ui_find_transactions_dialog_destroy(FindTransactionsDialog * pcd);
|
||||
|
||||
#endif
|
||||
@@ -2271,7 +2271,7 @@ create_autoCreate_ledger( sxSinceLastData *sxsld )
|
||||
Query *q;
|
||||
|
||||
q = xaccMallocQuery();
|
||||
xaccQueryAddSingleBookMatch( q, gnc_get_current_book(), QUERY_AND );
|
||||
xaccQuerySetBook (q, gnc_get_current_book ());
|
||||
sxsld->ac_ledger = gnc_ledger_display_query( q,
|
||||
GENERAL_LEDGER,
|
||||
REG_STYLE_LEDGER );
|
||||
@@ -2326,7 +2326,7 @@ create_created_ledger( sxSinceLastData *sxsld )
|
||||
Query *q;
|
||||
|
||||
q = xaccMallocQuery();
|
||||
xaccQueryAddSingleBookMatch( q, gnc_get_current_book(), QUERY_AND );
|
||||
xaccQuerySetBook (q, gnc_get_current_book ());
|
||||
sxsld->created_ledger = gnc_ledger_display_query( q,
|
||||
GENERAL_LEDGER,
|
||||
REG_STYLE_LEDGER );
|
||||
|
||||
@@ -3,7 +3,6 @@ glade_DATA = \
|
||||
account.glade \
|
||||
commodities.glade \
|
||||
fincalc.glade \
|
||||
find.glade \
|
||||
help.glade \
|
||||
newuser.glade \
|
||||
price.glade \
|
||||
|
||||
+45
-10
@@ -34,6 +34,13 @@
|
||||
#include "reconcile-list.h"
|
||||
#include "Transaction.h"
|
||||
|
||||
typedef enum {
|
||||
BY_STANDARD = 0,
|
||||
BY_NUM,
|
||||
BY_DESC,
|
||||
BY_AMOUNT
|
||||
} sort_type_t;
|
||||
|
||||
|
||||
/* Signal codes */
|
||||
enum
|
||||
@@ -139,16 +146,18 @@ gnc_reconcile_list_new(Account *account, GNCReconcileListType type)
|
||||
accounts = g_list_concat (accounts, children);
|
||||
}
|
||||
|
||||
xaccQueryAddAccountMatch (list->query, accounts, ACCT_MATCH_ANY, QUERY_AND);
|
||||
xaccQueryAddAccountMatch (list->query, accounts, GUID_MATCH_ANY, QUERY_AND);
|
||||
|
||||
g_list_free (accounts);
|
||||
|
||||
if (type == RECLIST_CREDIT)
|
||||
DxaccQueryAddValueMatch(list->query, 0.0, AMT_SGN_MATCH_CREDIT,
|
||||
AMT_MATCH_ATLEAST, QUERY_AND);
|
||||
xaccQueryAddValueMatch(list->query, gnc_numeric_zero (),
|
||||
NUMERIC_MATCH_CREDIT,
|
||||
COMPARE_GTE, QUERY_AND);
|
||||
else
|
||||
DxaccQueryAddValueMatch(list->query, 0.0, AMT_SGN_MATCH_DEBIT,
|
||||
AMT_MATCH_ATLEAST, QUERY_AND);
|
||||
xaccQueryAddValueMatch(list->query, gnc_numeric_zero (),
|
||||
NUMERIC_MATCH_DEBIT,
|
||||
COMPARE_GTE, QUERY_AND);
|
||||
|
||||
return GTK_WIDGET(list);
|
||||
}
|
||||
@@ -840,10 +849,11 @@ gnc_reconcile_list_changed (GNCReconcileList *list)
|
||||
* Args: list - list to change the sort order for *
|
||||
* Returns: nothing *
|
||||
\********************************************************************/
|
||||
void
|
||||
static void
|
||||
gnc_reconcile_list_set_sort_order (GNCReconcileList *list, sort_type_t key)
|
||||
{
|
||||
gint column;
|
||||
gboolean key_changed = FALSE;
|
||||
gboolean sort_order;
|
||||
|
||||
g_return_if_fail (list != NULL);
|
||||
@@ -866,6 +876,8 @@ gnc_reconcile_list_set_sort_order (GNCReconcileList *list, sort_type_t key)
|
||||
case BY_AMOUNT: column = 3; break;
|
||||
}
|
||||
list->increasing = (list->key == key) ? !list->increasing : TRUE;
|
||||
if (list->key != key)
|
||||
key_changed = TRUE;
|
||||
list->key = key;
|
||||
sort_order = list->increasing;
|
||||
if ((list->list_type == RECLIST_CREDIT) && (key == BY_AMOUNT))
|
||||
@@ -877,10 +889,33 @@ gnc_reconcile_list_set_sort_order (GNCReconcileList *list, sort_type_t key)
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_widget_show(list->title_arrow[column]);
|
||||
|
||||
/* Set the sort order for the engine */
|
||||
xaccQuerySetSortOrder (list->query, key,
|
||||
(key == BY_STANDARD) ? BY_NONE : BY_STANDARD,
|
||||
BY_NONE);
|
||||
/* Set the sort order for the engine, if the key changed */
|
||||
if (key_changed)
|
||||
{
|
||||
GSList *p1 = NULL, *p2;
|
||||
|
||||
p2 = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
|
||||
|
||||
switch (key) {
|
||||
case BY_STANDARD:
|
||||
p1 = p2;
|
||||
p2 = NULL;
|
||||
break;
|
||||
case BY_NUM:
|
||||
p1 = g_slist_prepend (p1, TRANS_NUM);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
break;
|
||||
case BY_DESC:
|
||||
p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
break;
|
||||
case BY_AMOUNT:
|
||||
p1 = g_slist_prepend (p1, SPLIT_VALUE);
|
||||
break;
|
||||
}
|
||||
gncQuerySetSortOrder (list->query, p1, p2, NULL);
|
||||
}
|
||||
|
||||
xaccQuerySetSortIncreasing (list->query,
|
||||
sort_order,
|
||||
sort_order,
|
||||
|
||||
@@ -71,7 +71,7 @@ struct _GNCReconcileList
|
||||
GNCReconcileList *sibling;
|
||||
|
||||
/* Sorting info */
|
||||
sort_type_t key;
|
||||
gint key;
|
||||
gboolean increasing;
|
||||
GtkWidget *title_arrow[5];
|
||||
|
||||
@@ -118,9 +118,6 @@ void gnc_reconcile_list_unselect_all(GNCReconcileList *list);
|
||||
|
||||
gboolean gnc_reconcile_list_changed(GNCReconcileList *list);
|
||||
|
||||
void gnc_reconcile_list_set_sort_order(GNCReconcileList *list,
|
||||
sort_type_t key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
+49
-11
@@ -58,6 +58,16 @@
|
||||
#include "window-report.h"
|
||||
#include "top-level.h"
|
||||
|
||||
typedef enum {
|
||||
BY_STANDARD = 0,
|
||||
BY_DATE,
|
||||
BY_DATE_ENTERED,
|
||||
BY_DATE_RECONCILED,
|
||||
BY_NUM,
|
||||
BY_AMOUNT,
|
||||
BY_MEMO,
|
||||
BY_DESC
|
||||
} sort_type_t;
|
||||
|
||||
typedef struct _RegDateWindow RegDateWindow;
|
||||
struct _RegDateWindow
|
||||
@@ -117,6 +127,7 @@ static short module = MOD_GUI;
|
||||
static int last_width = 0;
|
||||
static int last_stock_width = 0;
|
||||
|
||||
static GSList *date_param = NULL;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
static void gnc_register_redraw_all_cb (GnucashRegister *g_reg, gpointer data);
|
||||
@@ -346,44 +357,61 @@ gnc_register_sort (RegWindow *regData, sort_type_t sort_code)
|
||||
{
|
||||
Query *query = gnc_ledger_display_get_query (regData->ledger);
|
||||
gboolean show_present_divider = FALSE;
|
||||
GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
|
||||
SplitRegister *reg;
|
||||
|
||||
if (regData->sort_type == sort_code)
|
||||
return;
|
||||
|
||||
standard = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
|
||||
|
||||
switch (sort_code)
|
||||
{
|
||||
case BY_STANDARD:
|
||||
xaccQuerySetSortOrder(query, BY_STANDARD, BY_NONE, BY_NONE);
|
||||
p1 = standard;
|
||||
show_present_divider = TRUE;
|
||||
break;
|
||||
case BY_DATE:
|
||||
xaccQuerySetSortOrder(query, BY_DATE, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
show_present_divider = TRUE;
|
||||
break;
|
||||
case BY_DATE_ENTERED:
|
||||
xaccQuerySetSortOrder(query, BY_DATE_ENTERED, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DATE_RECONCILED:
|
||||
xaccQuerySetSortOrder(query, BY_RECONCILE, BY_DATE_RECONCILED,
|
||||
BY_STANDARD);
|
||||
p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
|
||||
p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
|
||||
p3 = standard;
|
||||
break;
|
||||
case BY_NUM:
|
||||
xaccQuerySetSortOrder(query, BY_NUM, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_NUM);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_AMOUNT:
|
||||
xaccQuerySetSortOrder(query, BY_AMOUNT, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, SPLIT_VALUE);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_MEMO:
|
||||
xaccQuerySetSortOrder(query, BY_MEMO, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, SPLIT_MEMO);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DESC:
|
||||
xaccQuerySetSortOrder(query, BY_DESC, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
default:
|
||||
g_slist_free (standard);
|
||||
g_return_if_fail (FALSE);
|
||||
}
|
||||
|
||||
gncQuerySetSortOrder (query, p1, p2, p3);
|
||||
|
||||
reg = gnc_ledger_display_get_split_register (regData->ledger);
|
||||
|
||||
gnc_split_register_show_present_divider (reg, show_present_divider);
|
||||
@@ -554,7 +582,12 @@ gnc_register_set_date_range(RegWindow *regData)
|
||||
|
||||
toggle = GTK_TOGGLE_BUTTON(regDateData->show_earliest);
|
||||
|
||||
xaccQueryPurgeTerms (query, PD_DATE);
|
||||
if (date_param == NULL) {
|
||||
date_param = g_slist_prepend (NULL, TRANS_DATE_POSTED);
|
||||
date_param = g_slist_prepend (date_param, SPLIT_TRANS);
|
||||
}
|
||||
|
||||
gncQueryPurgeTerms (query, date_param);
|
||||
|
||||
if (!gtk_toggle_button_get_active(toggle))
|
||||
{
|
||||
@@ -2054,10 +2087,15 @@ regWindowLedger (GNCLedgerDisplay *ledger)
|
||||
"Show All Transactions",
|
||||
TRUE);
|
||||
|
||||
if (date_param == NULL) {
|
||||
date_param = g_slist_prepend (NULL, TRANS_DATE_POSTED);
|
||||
date_param = g_slist_prepend (date_param, SPLIT_TRANS);
|
||||
}
|
||||
|
||||
{
|
||||
Query *q = gnc_ledger_display_get_query (regData->ledger);
|
||||
|
||||
has_date = xaccQueryHasTermType (q, PD_DATE);
|
||||
has_date = gncQueryHasTermType (q, date_param);
|
||||
}
|
||||
|
||||
if (has_date)
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
(let ((query (gnc:malloc-query))
|
||||
(xtns #f))
|
||||
|
||||
(gnc:query-set-book query (gnc:group-get-book group))
|
||||
|
||||
;; we want to find all transactions with every split inside the
|
||||
;; account group.
|
||||
(gnc:query-add-account-match query
|
||||
(gnc:group-get-subaccounts group)
|
||||
'acct-match-any 'query-or)
|
||||
(d-gnc:query-set-group query group)
|
||||
(set! xtns (gnc:query-get-transactions query 'query-match-all))
|
||||
'guid-match-any 'query-or)
|
||||
|
||||
(set! xtns (gnc:query-get-transactions query 'query-txn-match-all))
|
||||
|
||||
;; lose the query
|
||||
(gnc:free-query query)
|
||||
@@ -42,7 +44,7 @@
|
||||
(for-each
|
||||
(lambda (xtn)
|
||||
(let ((query (gnc:malloc-query)))
|
||||
(d-gnc:query-set-group query old-group)
|
||||
(gnc:query-set-book query (gnc:group-get-book old-group))
|
||||
|
||||
;; the date should be close to the same.. +/- a week.
|
||||
(let ((date (gnc:transaction-get-date-posted xtn)))
|
||||
@@ -53,11 +55,11 @@
|
||||
;; for each split in the transaction, add a term to match the
|
||||
;; properties of one split
|
||||
(let ((q-splits (gnc:malloc-query)))
|
||||
(d-gnc:query-set-group q-splits old-group)
|
||||
(gnc:query-set-book q-splits (gnc:group-get-book old-group))
|
||||
(for-each
|
||||
(lambda (split)
|
||||
(let ((sq (gnc:malloc-query)))
|
||||
(d-gnc:query-set-group sq old-group)
|
||||
(gnc:query-set-book sq (gnc:group-get-book old-group))
|
||||
|
||||
;; we want to match the account in the old group that
|
||||
;; has the same name as an account in the new group. If
|
||||
@@ -74,9 +76,9 @@
|
||||
;; we want the value for the split to match the value
|
||||
;; the old-group split. We should really check for
|
||||
;; fuzziness.
|
||||
(d-gnc:query-add-value-match
|
||||
sq (gnc:numeric-to-double (gnc:split-get-value split))
|
||||
'amt-sgn-match-either 'amt-match-exactly
|
||||
(gnc:query-add-value-match
|
||||
sq (gnc:split-get-value split)
|
||||
'amt-sgn-match-either 'query-compare-equal
|
||||
'query-and)
|
||||
|
||||
;; now merge into the split query. Reminder: q-splits
|
||||
@@ -98,7 +100,7 @@
|
||||
|
||||
;; now that we have built a query, get transactions in the old
|
||||
;; account group that matches it.
|
||||
(let ((old-xtns (gnc:query-get-transactions query 'query-match-all)))
|
||||
(let ((old-xtns (gnc:query-get-transactions query 'query-txn-match-all)))
|
||||
(set! old-xtns (map
|
||||
(lambda (elt)
|
||||
(cons elt #f)) old-xtns))
|
||||
|
||||
@@ -423,10 +423,6 @@ gnc_ledger_display_gl (void)
|
||||
|
||||
xaccQuerySetBook (query, gnc_get_current_book());
|
||||
|
||||
xaccQueryAddBalanceMatch (query,
|
||||
BALANCE_BALANCED | BALANCE_UNBALANCED,
|
||||
QUERY_AND);
|
||||
|
||||
start = time (NULL);
|
||||
|
||||
tm = localtime (&start);
|
||||
@@ -466,6 +462,7 @@ gnc_ledger_display_template_gl (char *id)
|
||||
q = xaccMallocQuery ();
|
||||
|
||||
book = gnc_get_current_book ();
|
||||
xaccQuerySetBook (q, book);
|
||||
|
||||
ag = gnc_book_get_template_group (book);
|
||||
acct = xaccGetAccountFromName (ag, id);
|
||||
@@ -475,12 +472,7 @@ gnc_ledger_display_template_gl (char *id)
|
||||
PERR( "can't get template account for id \"%s\"\n", id );
|
||||
}
|
||||
|
||||
xaccQueryAddSingleBookMatch( q, book, QUERY_AND );
|
||||
xaccQueryAddSingleAccountMatch (q, acct, QUERY_AND);
|
||||
xaccQuerySearchTemplateGroup( q, TRUE );
|
||||
|
||||
//PWARN ("cannot use queries in this way call <linas@linas.org> to fix");
|
||||
//DxaccQuerySetGroup (q, gnc_book_get_template_group(book));
|
||||
|
||||
ld = gnc_ledger_display_internal (NULL, q, LD_GL,
|
||||
GENERAL_LEDGER,
|
||||
@@ -638,7 +630,7 @@ gnc_ledger_display_make_query (GNCLedgerDisplay *ld,
|
||||
accounts = g_list_prepend (accounts, leader);
|
||||
|
||||
xaccQueryAddAccountMatch (ld->query, accounts,
|
||||
ACCT_MATCH_ANY, QUERY_AND);
|
||||
GUID_MATCH_ANY, QUERY_AND);
|
||||
|
||||
g_list_free (accounts);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,19 @@ static void emit_expand_ent_cb( GtkWidget *widget, gpointer data );
|
||||
static void emit_blank_cb( GtkWidget *widget, gpointer data );
|
||||
static void emit_jump_cb( GtkWidget *widget, gpointer data );
|
||||
|
||||
/* Easy way to pass the sort-type */
|
||||
typedef enum {
|
||||
BY_NONE = 0,
|
||||
BY_STANDARD,
|
||||
BY_DATE,
|
||||
BY_DATE_ENTERED,
|
||||
BY_DATE_RECONCILED,
|
||||
BY_NUM,
|
||||
BY_AMOUNT,
|
||||
BY_MEMO,
|
||||
BY_DESC
|
||||
} sort_type_t;
|
||||
|
||||
guint
|
||||
gnc_regWidget_get_type ()
|
||||
{
|
||||
@@ -398,44 +411,61 @@ gnc_register_sort (GNCRegWidget *rw, sort_type_t sort_code)
|
||||
{
|
||||
Query *query = gnc_ledger_display_get_query (rw->ledger);
|
||||
gboolean show_present_divider = FALSE;
|
||||
GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
|
||||
SplitRegister *reg;
|
||||
|
||||
if (rw->sort_type == sort_code)
|
||||
return;
|
||||
|
||||
standard = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
|
||||
|
||||
switch (sort_code)
|
||||
{
|
||||
case BY_STANDARD:
|
||||
xaccQuerySetSortOrder(query, BY_STANDARD, BY_NONE, BY_NONE);
|
||||
p1 = standard;
|
||||
show_present_divider = TRUE;
|
||||
break;
|
||||
case BY_DATE:
|
||||
xaccQuerySetSortOrder(query, BY_DATE, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
show_present_divider = TRUE;
|
||||
break;
|
||||
case BY_DATE_ENTERED:
|
||||
xaccQuerySetSortOrder(query, BY_DATE_ENTERED, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DATE_RECONCILED:
|
||||
xaccQuerySetSortOrder(query, BY_RECONCILE, BY_DATE_RECONCILED,
|
||||
BY_STANDARD);
|
||||
p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
|
||||
p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
|
||||
p3 = standard;
|
||||
break;
|
||||
case BY_NUM:
|
||||
xaccQuerySetSortOrder(query, BY_NUM, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_NUM);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_AMOUNT:
|
||||
xaccQuerySetSortOrder(query, BY_AMOUNT, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, SPLIT_VALUE);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_MEMO:
|
||||
xaccQuerySetSortOrder(query, BY_MEMO, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, SPLIT_MEMO);
|
||||
p2 = standard;
|
||||
break;
|
||||
case BY_DESC:
|
||||
xaccQuerySetSortOrder(query, BY_DESC, BY_STANDARD, BY_NONE);
|
||||
p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
|
||||
p1 = g_slist_prepend (p1, SPLIT_TRANS);
|
||||
p2 = standard;
|
||||
break;
|
||||
default:
|
||||
g_slist_free (standard);
|
||||
g_return_if_fail (FALSE);
|
||||
}
|
||||
|
||||
gncQuerySetSortOrder (query, p1, p2, p3);
|
||||
|
||||
reg = gnc_ledger_display_get_split_register (rw->ledger);
|
||||
|
||||
gnc_split_register_show_present_divider (reg, show_present_divider);
|
||||
@@ -1350,6 +1380,7 @@ struct foo {
|
||||
static void
|
||||
gnc_regWidget_init2( GNCRegWidget *rw, GNCLedgerDisplay *ledger, GtkWindow *win )
|
||||
{
|
||||
static GSList *date_param = NULL;
|
||||
static struct foo bar[] = {
|
||||
{ "enter_ent", recordCB },
|
||||
{ "cancel_ent", cancelCB },
|
||||
@@ -1411,10 +1442,15 @@ gnc_regWidget_init2( GNCRegWidget *rw, GNCLedgerDisplay *ledger, GtkWindow *win
|
||||
"Show All Transactions",
|
||||
TRUE);
|
||||
|
||||
if (date_param == NULL) {
|
||||
date_param = g_slist_prepend (NULL, TRANS_DATE_POSTED);
|
||||
date_param = g_slist_prepend (date_param, SPLIT_TRANS);
|
||||
}
|
||||
|
||||
{
|
||||
Query *q = gnc_ledger_display_get_query (rw->ledger);
|
||||
|
||||
has_date = xaccQueryHasTermType (q, PD_DATE);
|
||||
has_date = gncQueryHasTermType (q, date_param);
|
||||
}
|
||||
|
||||
if (has_date)
|
||||
|
||||
@@ -69,7 +69,7 @@ struct _GNCRegWidget {
|
||||
/* The actual sheet widget */
|
||||
GnucashRegister *reg;
|
||||
|
||||
sort_type_t sort_type;
|
||||
gint sort_type;
|
||||
};
|
||||
|
||||
struct _GNCRegWidgetClass {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
(gnc:query-set-match-non-voids-only! query (gnc:get-current-book))
|
||||
(gnc:query-add-account-match query
|
||||
currency-accounts
|
||||
'acct-match-any 'query-and)
|
||||
'guid-match-any 'query-and)
|
||||
(gnc:query-add-date-match-timepair
|
||||
query #f end-date-tp #t end-date-tp 'query-and)
|
||||
|
||||
|
||||
@@ -512,9 +512,12 @@
|
||||
(gnc:query-set-book query (gnc:get-current-book))
|
||||
(gnc:query-add-single-account-match query account 'query-and)
|
||||
(gnc:query-add-date-match-timepair query #f date #t date 'query-and)
|
||||
(gnc:query-set-sort-order query 'by-date 'by-standard 'by-none)
|
||||
(gnc:query-set-sort-order query
|
||||
(list gnc:split-trans gnc:trans-date-posted)
|
||||
(list gnc:query-default-sort)
|
||||
'())
|
||||
(gnc:query-set-sort-increasing query #t #t #t)
|
||||
(gnc:query-set-max-splits query 1)
|
||||
(gnc:query-set-max-results query 1)
|
||||
|
||||
(set! splits (gnc:query-get-splits query))
|
||||
(gnc:free-query query)
|
||||
|
||||
@@ -272,7 +272,9 @@ more than one currency. This report is not designed to cope with this possibili
|
||||
(gnc:query-set-match-non-voids-only! query (gnc:get-current-book))
|
||||
(gnc:query-add-single-account-match query account 'query-and)
|
||||
(gnc:query-add-date-match-timepair query #t begindate #t date 'query-and)
|
||||
(gnc:query-set-sort-order query 'by-date 'by-none 'by-none)
|
||||
(gnc:query-set-sort-order query
|
||||
(list gnc:split-trans gnc:trans-date-posted)
|
||||
'() '())
|
||||
(gnc:query-set-sort-increasing query #t #t #t)))
|
||||
|
||||
|
||||
|
||||
@@ -343,13 +343,15 @@
|
||||
(set! accounts
|
||||
(delete-duplicates (append accounts subaccts)))))
|
||||
|
||||
(gnc:query-add-account-match query accounts 'acct-match-any 'query-and)
|
||||
(gnc:query-add-account-match query accounts 'guid-match-any 'query-and)
|
||||
|
||||
;; match splits between start and end dates
|
||||
(gnc:query-add-date-match-timepair
|
||||
query #t begindate #t enddate 'query-and)
|
||||
(gnc:query-set-sort-order
|
||||
query 'by-date 'by-standard 'by-none)
|
||||
(gnc:query-set-sort-order query
|
||||
(list gnc:split-trans gnc:trans-date-posted)
|
||||
(list gnc:query-default-sort)
|
||||
'())
|
||||
|
||||
;; get the query results
|
||||
(set! splits (gnc:query-get-splits query))
|
||||
|
||||
@@ -963,39 +963,43 @@ Credit Card, and Income accounts")))))
|
||||
;; 'sorting-key-option-value (vector 'query-sorting-key
|
||||
;; subtotal-function subtotal-renderer))
|
||||
(list (cons 'account-name (vector
|
||||
'by-account-full-name
|
||||
(list gnc:split-account-fullname)
|
||||
split-account-full-name-same-p
|
||||
render-account-full-name-subheading
|
||||
render-account-full-name-subtotal))
|
||||
(cons 'account-code (vector
|
||||
'by-account-code
|
||||
(list gnc:split-account gnc:account-code)
|
||||
split-account-code-same-p
|
||||
render-account-code-subheading
|
||||
render-account-code-subtotal))
|
||||
(cons 'exact-time (vector 'by-date #f #f #f))
|
||||
(cons 'exact-time (vector
|
||||
(list gnc:split-trans gnc:trans-date-posted)
|
||||
#f #f #f))
|
||||
(cons 'date (vector
|
||||
'by-date #f #f #f))
|
||||
(list gnc:split-trans gnc:trans-date-posted)
|
||||
#f #f #f))
|
||||
(cons 'register-order
|
||||
(vector
|
||||
'by-standard
|
||||
(list gnc:query-default-sort)
|
||||
#f
|
||||
#f
|
||||
#f))
|
||||
(cons 'corresponding-acc-name
|
||||
(vector 'by-corr-account-full-name
|
||||
(vector (list gnc:split-corr-account-fullname)
|
||||
split-same-corr-account-full-name-p
|
||||
render-corresponding-account-name-subheading
|
||||
render-corresponding-account-name-subtotal))
|
||||
(cons 'corresponding-acc-code
|
||||
(vector 'by-corr-account-code
|
||||
(vector (list gnc:split-corr-account-code)
|
||||
split-same-corr-account-code-p
|
||||
render-corresponding-account-code-subheading
|
||||
render-corresponding-account-code-subtotal))
|
||||
(cons 'amount (vector 'by-amount #f #f #f))
|
||||
(cons 'description (vector 'by-desc #f #f #f))
|
||||
(cons 'number (vector 'by-num #f #f #f))
|
||||
(cons 'memo (vector 'by-memo #f #f #f))
|
||||
(cons 'none (vector 'by-none #f #f #f))))
|
||||
(cons 'amount (vector (list gnc:split-value) #f #f #f))
|
||||
(cons 'description (vector (list gnc:split-trans gnc:trans-desc)
|
||||
#f #f #f))
|
||||
(cons 'number (vector (list gnc:split-trans gnc:trans-num) #f #f #f))
|
||||
(cons 'memo (vector (list gnc:split-memo) #f #f #f))
|
||||
(cons 'none (vector '() #f #f #f))))
|
||||
|
||||
(define date-comp-funcs-assoc-list
|
||||
;; Extra list for date option. Each entry: (cons
|
||||
@@ -1087,13 +1091,14 @@ Credit Card, and Income accounts")))))
|
||||
;;(gnc:warn "query is:" query)
|
||||
(gnc:query-add-account-match query
|
||||
c_account_1
|
||||
'acct-match-any 'query-and)
|
||||
'guid-match-any 'query-and)
|
||||
(gnc:query-add-date-match-timepair
|
||||
query #t begindate #t enddate 'query-and)
|
||||
(gnc:query-set-sort-order query
|
||||
(get-query-sortkey primary-key)
|
||||
(get-query-sortkey secondary-key)
|
||||
'by-none)
|
||||
(get-query-sortkey primary-key)
|
||||
(get-query-sortkey secondary-key)
|
||||
'())
|
||||
|
||||
(gnc:query-set-sort-increasing query
|
||||
(eq? primary-order 'ascend)
|
||||
(eq? secondary-order 'ascend)
|
||||
|
||||
@@ -20,8 +20,9 @@ GNC_TEST_DEPS := \
|
||||
--guile-load-dir ${top_srcdir}/src/gnome \
|
||||
--guile-load-dir ${top_srcdir}/src/report/report-system \
|
||||
--guile-load-dir ${top_srcdir}/src/report/utility-reports \
|
||||
--library-dir ${top_builddir}/src/gnome-utils \
|
||||
--library-dir ${top_builddir}/src/gnome
|
||||
--library-dir ${top_builddir}/src/gnome-utils \
|
||||
--library-dir ${top_builddir}/src/gnome \
|
||||
--library-dir ${G_WRAP_LIB_DIR}
|
||||
|
||||
TESTS_ENVIRONMENT := \
|
||||
$(shell ${top_srcdir}/src/gnc-test-env --no-exports ${GNC_TEST_DEPS})
|
||||
|
||||
@@ -127,7 +127,5 @@ gchar* get_random_string_without(const char *exclude_chars);
|
||||
gint64 get_random_gint64(void);
|
||||
double get_random_double(void);
|
||||
const char* get_random_string_in_array(const char* str_list[]);
|
||||
#define get_random_numeric() (double_to_gnc_numeric (get_random_double (), \
|
||||
GNC_DENOM_AUTO, GNC_RND_ROUND))
|
||||
|
||||
#endif /* TEST_STUFF_H */
|
||||
Reference in new issue
Block a user