summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/transaction.cpp
authorallenforsythe <allenforsythe>2003-05-16 20:08:38 (UTC)
committer allenforsythe <allenforsythe>2003-05-16 20:08:38 (UTC)
commite6ff2dbd2d128c3cf873e23f4df8006759b47079 (patch) (side-by-side diff)
treebb3c996b76c8937d871f642f0e32032848d32396 /noncore/apps/qashmoney/transaction.cpp
parent87051a7ba4834aed152bc09aad7f4935c9729ccb (diff)
downloadopie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.zip
opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.gz
opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.bz2
Working on time frame for displaying cleared transactions. Not yet working.
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
@@ -8,6 +8,7 @@
#include "transactiondisplay.h"
#include <stdlib.h>
+#include <iostream.h>
extern Account *account;
extern Preferences *preferences;
@@ -154,9 +155,10 @@ int Transaction::getYear ( int id )
return yearstring.toInt();
}
-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;
// select the transactions to display
// two different statements are used based on
@@ -166,14 +168,14 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
if ( showcleared == 0 )
{
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 );
}
else
{
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
sqlite_get_table_printf ( tdb, "select day, month, year, payee, amount, transid, accountid from transactions where accountid = %i and payee like '%q';", &results, &rows, &columns, NULL, id, limit );
}
@@ -182,14 +184,8 @@ void Transaction::displayTransactions ( QListView *listview, int id, bool childr
int counter = 7;
while ( counter < ( ( rows + 1 ) * columns ) )
{
- // 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 ] ) );
// construct transaction name, amount, id
QString payee = results [ counter + 3 ];