summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/transaction.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/qashmoney/transaction.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/transaction.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/noncore/apps/qashmoney/transaction.cpp b/noncore/apps/qashmoney/transaction.cpp
index af7d18f..5ecc7ed 100755
--- a/noncore/apps/qashmoney/transaction.cpp
+++ b/noncore/apps/qashmoney/transaction.cpp
@@ -10,2 +10,3 @@
#include <stdlib.h>
+#include <iostream.h>
@@ -156,5 +157,6 @@ int Transaction::getYear ( int id )
-void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit )
+void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate )
{
int showcleared = preferences->getPreference ( 3 );
+ int year = ( displaydate.year() ) - 1;
@@ -168,5 +170,5 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
if ( account->getParentAccountID ( id ) == -1 && children == TRUE )
- sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 and parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit );
+ sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 and year >= %i parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, year, id, limit );
else
- sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 and accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit );
+ sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where cleared = 0 year >= %i accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, year, id, limit );
}
@@ -175,3 +177,3 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
if ( account->getParentAccountID ( id ) == -1 && children == TRUE )
- sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit );
+ sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where year >= %i and parentid = %i and payee like '%q';", &results, &rows, &columns, NULL, year, id, limit );
else
@@ -184,10 +186,4 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
{
- // construct the date
- //QString daystring = results [ counter ];
- //int day = results [ counter ].toInt ();
- //QString monthstring = results [ counter + 1 ];
- //int month = results [ counter + 1 ].toInt ();
- //QString yearstring = results [ counter + 2 ];
- //int year = results [ counter + 2 ].toInt ();
- QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) );
+ QDate displaydate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) );
+ QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) );