author | allenforsythe <allenforsythe> | 2003-05-28 11:49:47 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-28 11:49:47 (UTC) |
commit | 52047fd3d3f30509d65834747c3a0c5c6760dc01 (patch) (side-by-side diff) | |
tree | 136945c2ffff2434ba1e3c8959b5335f5016e8f8 /noncore/apps/qashmoney/transfer.cpp | |
parent | 7c85b3e98921afa74c7c6a90da4dfd54631c89c5 (diff) | |
download | opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.zip opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.gz opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'noncore/apps/qashmoney/transfer.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/transfer.cpp | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/noncore/apps/qashmoney/transfer.cpp b/noncore/apps/qashmoney/transfer.cpp index 77cbb4e..568d584 100755 --- a/noncore/apps/qashmoney/transfer.cpp +++ b/noncore/apps/qashmoney/transfer.cpp @@ -56,25 +56,25 @@ int Transfer::getNumberOfTransfers () } int Transfer::getNumberOfTransfers ( int accountid ) { char **results; sqlite_get_table_printf ( db, "select count() from transfers where fromaccount = %i;", &results, 0, 0, 0, accountid ); int transfers = atoi ( results [ 1 ] ); sqlite_get_table_printf ( db, "select count() from transfers where toaccount = %i;", &results, 0, 0, 0, accountid ); transfers = transfers + atoi ( results [ 1 ] ); return transfers; } -void Transfer::displayTransfers ( QListView *listview, int accountid, bool children ) +void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ) { int showcleared = preferences->getPreference ( 3 ); // select the from transfers to display char **results; int rows, columns; if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE ) { if ( showcleared == 0 ) sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where cleared = 0 and toparent = %i;", &results, &rows, &columns, 0, accountid ); else sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where toparent = %i;", &results, &rows, &columns, 0, accountid ); @@ -91,52 +91,55 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child int counter = 7; int position = 0; while ( counter < ( ( rows + 1 ) * columns ) ) { // construct the date QString daystring = results [ counter ]; int day = daystring.toInt (); QString monthstring = results [ counter + 1 ]; int month = monthstring.toInt (); QString yearstring = results [ counter + 2 ]; int year = yearstring.toInt (); QString date = preferences->getDate ( year, month, day ); + QDate testdate ( year, month, day ); //construct the amount and id strings QString amount = results [ counter + 3 ]; QString id = results [ counter + 4 ]; // construct the transaction name QString transactionname = "FROM: "; QString temp1 = results [ counter + 5 ]; transactionname.append ( account->getAccountName ( temp1.toInt() ) ); QString toaccount = account->getAccountName ( atol ( results [ counter + 6 ] ) ); - // display this transfer - if ( account->getParentAccountID ( accountid ) == -1 ) + if ( testdate >= displaydate || showcleared == 0 ) { - if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) - ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount ); + // display this transfer + if ( account->getParentAccountID ( accountid ) == -1 ) + { + if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) + ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount ); + else + QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount ); + } else - QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount ); + { + if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) + ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); + else + QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); + } } - else - { - if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) - ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); - else - QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); - } - counter = counter + 7; } // select the to transfers to display char **toresults; rows = 0; columns = 0; if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE ) { if ( showcleared == 0 ) sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where cleared = 0 and fromparent = %i;", &toresults, &rows, &columns, 0, accountid ); else @@ -154,51 +157,55 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child counter = 7; position = 0; while ( counter < ( ( rows + 1 ) * columns ) ) { // construct the date QString daystring = toresults [ counter ]; int day = daystring.toInt (); QString monthstring = toresults [ counter + 1 ]; int month = monthstring.toInt (); QString yearstring = toresults [ counter + 2 ]; int year = yearstring.toInt (); QString date = preferences->getDate ( year, month, day ); + QDate testdate ( year, month, day ); //construct the amount and id strings QString amount = toresults [ counter + 3 ]; amount.prepend ( "-" ); QString id = toresults [ counter + 4 ]; // construct the transaction name QString transactionname = "TO: "; QString temp1 = toresults [ counter + 6 ]; transactionname.append ( account->getAccountName ( temp1.toInt() ) ); QString fromaccount = account->getAccountName ( atol ( toresults [ counter + 5 ] ) ); - // display this transfer - if ( account->getParentAccountID ( accountid ) == -1 ) - { - if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) - ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount ); - else - QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount ); - } - else - { - if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) - ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); + if ( testdate >= displaydate || showcleared == 0 ) + { + // display this transfer + if ( account->getParentAccountID ( accountid ) == -1 ) + { + if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) + ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount ); + else + QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount ); + } else - QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); + { + if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) + ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); + else + QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); + } } counter = counter + 7; } } int Transfer::getCleared ( int id ) { char **results; sqlite_get_table_printf ( db, "select cleared from transfers where transferid= %i;", &results, 0, 0, 0, id ); return atoi ( results [ 1 ] ); } |