Diffstat (limited to 'noncore/apps/qashmoney/transfer.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/transfer.cpp | 11 |
1 files changed, 9 insertions, 2 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 @@ -62,13 +62,13 @@ int Transfer::getNumberOfTransfers ( int 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; @@ -97,24 +97,27 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child 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 ] ) ); + 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, toaccount ); else @@ -124,13 +127,13 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child { 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; @@ -160,12 +163,13 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child 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 ]; @@ -173,12 +177,14 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child QString transactionname = "TO: "; QString temp1 = toresults [ counter + 6 ]; transactionname.append ( account->getAccountName ( temp1.toInt() ) ); QString fromaccount = account->getAccountName ( atol ( toresults [ counter + 5 ] ) ); + 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 @@ -188,12 +194,13 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child { 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 ) |