author | allenforsythe <allenforsythe> | 2003-05-16 20:08:38 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-16 20:08:38 (UTC) |
commit | e6ff2dbd2d128c3cf873e23f4df8006759b47079 (patch) (unidiff) | |
tree | bb3c996b76c8937d871f642f0e32032848d32396 /noncore | |
parent | 87051a7ba4834aed152bc09aad7f4935c9729ccb (diff) | |
download | opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.zip opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.gz opie-e6ff2dbd2d128c3cf873e23f4df8006759b47079.tar.bz2 |
Working on time frame for displaying cleared transactions. Not yet working.
-rwxr-xr-x | noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.cpp | 13 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.cpp | 2 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 42 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qmaccounts.db | bin | 4096 -> 6144 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmbudgets.db | bin | 3072 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmmemory.db | bin | 4096 -> 10240 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmpreferences.db | bin | 4096 -> 4096 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransactions.db | bin | 4096 -> 24576 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/qmtransfers.db | bin | 3072 -> 3072 bytes | |||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 49 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.h | 3 |
15 files changed, 106 insertions, 31 deletions
diff --git a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control index ffd11db..b00e3b1 100755 --- a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control +++ b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | |||
@@ -1,7 +1,7 @@ | |||
1 | Package: qashmoney | 1 | Package: qashmoney |
2 | Priority: optional | 2 | Priority: optional |
3 | Version: 0.74 | 3 | Version: 0.75 |
4 | Architecture: arm | 4 | Architecture: arm |
5 | Maintainer: Allen Forsythe qashmoneyman@attbi.com | 5 | Maintainer: Allen Forsythe qashmoneyman@attbi.com |
6 | Section: Applications | 6 | Section: Applications |
7 | Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. | 7 | Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. |
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp index 00d52c6..d7c66d3 100755 --- a/noncore/apps/qashmoney/preferencedialogs.cpp +++ b/noncore/apps/qashmoney/preferencedialogs.cpp | |||
@@ -67,56 +67,57 @@ void DatePreferences::setDefaultDatePreferences () | |||
67 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); | 67 | dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); |
68 | } | 68 | } |
69 | 69 | ||
70 | // START TRANSACTION PREFERENCES | 70 | // START TRANSACTION PREFERENCES |
71 | 71 | ||
72 | TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) | 72 | TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) |
73 | { | 73 | { |
74 | setCaption( tr ( "Transaction" ) ); | 74 | setCaption( tr ( "Transaction" ) ); |
75 | 75 | ||
76 | showclearedtransactions = new QCheckBox ( this ); | 76 | showclearedtransactions = new QCheckBox ( this ); |
77 | showclearedtransactions->setText ( "Show Cleared Transactions" ); | 77 | showclearedtransactions->setText ( "Show Cleared Transactions" ); |
78 | 78 | ||
79 | excludetransfers = new QCheckBox ( this ); | ||
80 | excludetransfers->setText ( "Include Transfers In Limit View" ); | ||
81 | |||
82 | limittransactionsbox = new QHBox ( this ); | 79 | limittransactionsbox = new QHBox ( this ); |
83 | limittransactionsbox->setSpacing ( 2 ); | 80 | limittransactionsbox->setSpacing ( 2 ); |
84 | limittransactionslabel = new QLabel ( "Limit All Transactions To", limittransactionsbox ); | 81 | limittransactionslabel = new QLabel ( "Show ", limittransactionsbox ); |
85 | limittransactions = new QComboBox ( limittransactionsbox ); | 82 | limittransactions = new QComboBox ( limittransactionsbox ); |
83 | QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox ); | ||
86 | limittransactions->insertItem ( "14 days" ); | 84 | limittransactions->insertItem ( "14 days" ); |
87 | limittransactions->insertItem ( "30 days" ); | 85 | limittransactions->insertItem ( "30 days" ); |
88 | limittransactions->insertItem ( "60 days" ); | ||
89 | limittransactions->insertItem ( "90 days" ); | 86 | limittransactions->insertItem ( "90 days" ); |
90 | limittransactions->insertItem ( "180 days" ); | 87 | limittransactions->insertItem ( "180 days" ); |
91 | limittransactions->insertItem ( "365 days" ); | 88 | limittransactions->insertItem ( "365 days" ); |
92 | limittransactions->insertItem ( "All" ); | 89 | limittransactions->insertItem ( "All" ); |
90 | limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) ); | ||
91 | |||
92 | excludetransfers = new QCheckBox ( this ); | ||
93 | excludetransfers->setText ( "Include Transfers In Limit View" ); | ||
93 | 94 | ||
94 | if ( preferences->getPreference ( 3 ) == 1 ) | 95 | if ( preferences->getPreference ( 3 ) == 1 ) |
95 | showclearedtransactions->setChecked ( TRUE ); | 96 | showclearedtransactions->setChecked ( TRUE ); |
96 | else | 97 | else |
97 | showclearedtransactions->setChecked ( FALSE ); | 98 | showclearedtransactions->setChecked ( FALSE ); |
98 | 99 | ||
99 | if ( preferences->getPreference ( 6 ) == 1 ) | 100 | if ( preferences->getPreference ( 6 ) == 1 ) |
100 | excludetransfers->setChecked ( TRUE ); | 101 | excludetransfers->setChecked ( TRUE ); |
101 | else | 102 | else |
102 | excludetransfers->setChecked ( FALSE ); | 103 | excludetransfers->setChecked ( FALSE ); |
103 | 104 | ||
104 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); | 105 | defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); |
105 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); | 106 | connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); |
106 | 107 | ||
107 | layout = new QVBoxLayout ( this, 2, 2 ); | 108 | layout = new QVBoxLayout ( this, 2, 2 ); |
108 | layout->addWidget ( showclearedtransactions ); | 109 | layout->addWidget ( showclearedtransactions ); |
109 | layout->addWidget ( excludetransfers ); | ||
110 | layout->addWidget ( limittransactionsbox ); | 110 | layout->addWidget ( limittransactionsbox ); |
111 | layout->addWidget ( excludetransfers ); | ||
111 | layout->insertSpacing ( 3, 5 ); | 112 | layout->insertSpacing ( 3, 5 ); |
112 | layout->addWidget ( defaults ); | 113 | layout->addWidget ( defaults ); |
113 | 114 | ||
114 | connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); | 115 | connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); |
115 | connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); | 116 | connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); |
116 | connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); | 117 | connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); |
117 | } | 118 | } |
118 | 119 | ||
119 | TransactionPreferences::~TransactionPreferences () | 120 | TransactionPreferences::~TransactionPreferences () |
120 | { | 121 | { |
121 | } | 122 | } |
122 | 123 | ||
diff --git a/noncore/apps/qashmoney/preferences.cpp b/noncore/apps/qashmoney/preferences.cpp index 819d5cf..9bf64dd 100755 --- a/noncore/apps/qashmoney/preferences.cpp +++ b/noncore/apps/qashmoney/preferences.cpp | |||
@@ -51,25 +51,25 @@ void Preferences::addPreferences () | |||
51 | // one touch account viewing preference 0 = no 1 = yes | 51 | // one touch account viewing preference 0 = no 1 = yes |
52 | rows = 0; | 52 | rows = 0; |
53 | sqlite_get_table ( db, "select preference from preferences where id = 5;", &results, &rows, &columns, 0 ); | 53 | sqlite_get_table ( db, "select preference from preferences where id = 5;", &results, &rows, &columns, 0 ); |
54 | if ( rows == 0 ) | 54 | if ( rows == 0 ) |
55 | sqlite_exec ( db, "insert into preferences values ( 0, 'onetouchviewing', 0, 0, 0, NULL );", 0, 0, 0 ); | 55 | sqlite_exec ( db, "insert into preferences values ( 0, 'onetouchviewing', 0, 0, 0, NULL );", 0, 0, 0 ); |
56 | 56 | ||
57 | // exclude transfers from limit view 0 = no 1 = yes | 57 | // exclude transfers from limit view 0 = no 1 = yes |
58 | rows = 0; | 58 | rows = 0; |
59 | sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); | 59 | sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); |
60 | if ( rows == 0 ) | 60 | if ( rows == 0 ) |
61 | sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); | 61 | sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); |
62 | 62 | ||
63 | // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 60 days, 3 = 90 days, 4 = 180 days, 5 = 365 days, 6 = all | 63 | // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 90 days, 3 = 180 days, 4 = 365 days 5 = all |
64 | rows = 0; | 64 | rows = 0; |
65 | sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); | 65 | sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); |
66 | if ( rows == 0 ) | 66 | if ( rows == 0 ) |
67 | sqlite_exec ( db, "insert into preferences values ( 0, 'limittransactions', 0, 0, 0, NULL );", 0, 0, 0 ); | 67 | sqlite_exec ( db, "insert into preferences values ( 0, 'limittransactions', 0, 0, 0, NULL );", 0, 0, 0 ); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | void Preferences::initializeColumnPreferences () | 71 | void Preferences::initializeColumnPreferences () |
72 | { | 72 | { |
73 | int rows = 0; | 73 | int rows = 0; |
74 | int columns = 0; | 74 | int columns = 0; |
75 | char **results; | 75 | char **results; |
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index 1ea358c..83eea01 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -134,30 +134,32 @@ void QashMoney::changeTabDisplay () | |||
134 | transactiondisplay->newtransaction->setEnabled ( FALSE ); | 134 | transactiondisplay->newtransaction->setEnabled ( FALSE ); |
135 | } | 135 | } |
136 | else //we selected a parent without children or a child | 136 | else //we selected a parent without children or a child |
137 | transactiondisplay->newtransaction->setEnabled ( TRUE ); | 137 | transactiondisplay->newtransaction->setEnabled ( TRUE ); |
138 | 138 | ||
139 | // disable the transactionid column so it can't be red | 139 | // disable the transactionid column so it can't be red |
140 | transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); | 140 | transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 ); |
141 | 141 | ||
142 | // set the accountid and children variables | 142 | // set the accountid and children variables |
143 | transactiondisplay->setChildren ( children ); | 143 | transactiondisplay->setChildren ( children ); |
144 | transactiondisplay->setAccountID ( accountid ); | 144 | transactiondisplay->setAccountID ( accountid ); |
145 | 145 | ||
146 | setTransactionDisplayDate (); | ||
147 | |||
146 | // display transactions | 148 | // display transactions |
147 | transactiondisplay->listview->clear(); | 149 | transactiondisplay->listview->clear(); |
148 | QString displaytext = "%"; | 150 | QString displaytext = "%"; |
149 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
150 | if ( transaction->getNumberOfTransactions() > 0 ) | 152 | if ( transaction->getNumberOfTransactions() > 0 ) |
151 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
152 | 154 | ||
153 | // display transfers | 155 | // display transfers |
154 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); |
155 | 157 | ||
156 | // open a new preferences object and resize the transaction display columns | 158 | // open a new preferences object and resize the transaction display columns |
157 | // each column will have a different size based on whether we are looking at a child | 159 | // each column will have a different size based on whether we are looking at a child |
158 | // account or children through a parent | 160 | // account or children through a parent |
159 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns | 161 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns |
160 | { | 162 | { |
161 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width | 163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width |
162 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
163 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width | 165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width |
@@ -245,26 +247,28 @@ void QashMoney::displayDatePreferencesDialog () | |||
245 | // set children so we can let displayTransfers know if there are children for the selected account | 247 | // set children so we can let displayTransfers know if there are children for the selected account |
246 | bool children; | 248 | bool children; |
247 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 249 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
248 | children = TRUE; | 250 | children = TRUE; |
249 | else | 251 | else |
250 | children = FALSE; | 252 | children = FALSE; |
251 | 253 | ||
252 | // redisplay transactions if they are visible incorporating | 254 | // redisplay transactions if they are visible incorporating |
253 | // any changes to the date format | 255 | // any changes to the date format |
254 | transactiondisplay->listview->clear(); | 256 | transactiondisplay->listview->clear(); |
255 | QString displaytext = "%"; | 257 | QString displaytext = "%"; |
256 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 258 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
259 | |||
260 | setTransactionDisplayDate(); | ||
257 | if ( transaction->getNumberOfTransactions() > 0 ) | 261 | if ( transaction->getNumberOfTransactions() > 0 ) |
258 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 262 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
259 | 263 | ||
260 | if ( transfer->getNumberOfTransfers() != 0 ) | 264 | if ( transfer->getNumberOfTransfers() != 0 ) |
261 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 265 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); |
262 | } | 266 | } |
263 | else if ( accountdisplay->isVisible() ) | 267 | else if ( accountdisplay->isVisible() ) |
264 | { | 268 | { |
265 | accountdisplay->listview->clearSelection(); | 269 | accountdisplay->listview->clearSelection(); |
266 | maintabs->setTabEnabled ( tab_2, FALSE ); | 270 | maintabs->setTabEnabled ( tab_2, FALSE ); |
267 | } | 271 | } |
268 | else | 272 | else |
269 | budgetdisplay->updateBudgetInformation(); | 273 | budgetdisplay->updateBudgetInformation(); |
270 | } | 274 | } |
@@ -281,26 +285,28 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
281 | 285 | ||
282 | // set children so we can let displayTransfers know if there are children for the selected account | 286 | // set children so we can let displayTransfers know if there are children for the selected account |
283 | bool children; | 287 | bool children; |
284 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) | 288 | if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) |
285 | children = TRUE; | 289 | children = TRUE; |
286 | else | 290 | else |
287 | children = FALSE; | 291 | children = FALSE; |
288 | 292 | ||
289 | // redisplay transactions incorporating any transaction preference changes | 293 | // redisplay transactions incorporating any transaction preference changes |
290 | transactiondisplay->listview->clear(); | 294 | transactiondisplay->listview->clear(); |
291 | QString displaytext = "%"; | 295 | QString displaytext = "%"; |
292 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 296 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
297 | |||
298 | setTransactionDisplayDate(); | ||
293 | if ( transaction->getNumberOfTransactions() > 0 ) | 299 | if ( transaction->getNumberOfTransactions() > 0 ) |
294 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext ); | 300 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
295 | 301 | ||
296 | if ( transfer->getNumberOfTransfers() != 0 ) | 302 | if ( transfer->getNumberOfTransfers() != 0 ) |
297 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 303 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); |
298 | } | 304 | } |
299 | else | 305 | else |
300 | { | 306 | { |
301 | accountdisplay->listview->clearSelection(); | 307 | accountdisplay->listview->clearSelection(); |
302 | maintabs->setTabEnabled ( tab_2, FALSE ); | 308 | maintabs->setTabEnabled ( tab_2, FALSE ); |
303 | } | 309 | } |
304 | } | 310 | } |
305 | 311 | ||
306 | void QashMoney::displayAccountPreferencesDialog () | 312 | void QashMoney::displayAccountPreferencesDialog () |
@@ -343,14 +349,42 @@ void QashMoney::disableOneTouchViewing () | |||
343 | { | 349 | { |
344 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); | 350 | disconnect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( showTransactions () ) ); |
345 | } | 351 | } |
346 | 352 | ||
347 | void QashMoney::toggleOneTouchViewing ( bool state ) | 353 | void QashMoney::toggleOneTouchViewing ( bool state ) |
348 | { | 354 | { |
349 | if ( state == TRUE ) | 355 | if ( state == TRUE ) |
350 | disableOneTouchViewing(); | 356 | disableOneTouchViewing(); |
351 | else | 357 | else |
352 | enableOneTouchViewing(); | 358 | enableOneTouchViewing(); |
353 | } | 359 | } |
354 | 360 | ||
355 | 361 | void QashMoney::setTransactionDisplayDate () | |
362 | { | ||
363 | // determine how many days of transactions to show | ||
364 | int limittype = preferences->getPreference ( 7 ); | ||
365 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | ||
366 | { | ||
367 | QDate today = QDate::currentDate (); | ||
368 | switch ( limittype ) // if we are not showing all transactions | ||
369 | { | ||
370 | case 0: // viewing two weeks | ||
371 | newdate = today.addDays ( -14 ); | ||
372 | break; | ||
373 | case 1: // viewing one month | ||
374 | newdate = today.addDays ( -30 ); | ||
375 | break; | ||
376 | case 2: // three months | ||
377 | newdate = today.addDays ( -90 ); | ||
378 | break; | ||
379 | case 3: // six months | ||
380 | newdate = today.addDays ( -180 ); | ||
381 | break; | ||
382 | case 4: // one year | ||
383 | newdate = today.addDays ( -365 ); | ||
384 | break; | ||
385 | } | ||
386 | } | ||
387 | else | ||
388 | newdate = QDate ( 1, 1, 1000 ); | ||
389 | } | ||
356 | 390 | ||
diff --git a/noncore/apps/qashmoney/qashmoney.h b/noncore/apps/qashmoney/qashmoney.h index cf0bd42..ec2c7ec 100755 --- a/noncore/apps/qashmoney/qashmoney.h +++ b/noncore/apps/qashmoney/qashmoney.h | |||
@@ -1,19 +1,20 @@ | |||
1 | #ifndef QASHMONEY_H | 1 | #ifndef QASHMONEY_H |
2 | #define QASHMONEY_H | 2 | #define QASHMONEY_H |
3 | 3 | ||
4 | #include <qpe/qpemenubar.h> | 4 | #include <qpe/qpemenubar.h> |
5 | #include <qpopupmenu.h> | 5 | #include <qpopupmenu.h> |
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | #include <qtabwidget.h> | 7 | #include <qtabwidget.h> |
8 | #include <qdatetime.h> | ||
8 | 9 | ||
9 | #include "accountdisplay.h" | 10 | #include "accountdisplay.h" |
10 | #include "transactiondisplay.h" | 11 | #include "transactiondisplay.h" |
11 | #include "budgetdisplay.h" | 12 | #include "budgetdisplay.h" |
12 | #include "account.h" | 13 | #include "account.h" |
13 | #include "preferences.h" | 14 | #include "preferences.h" |
14 | #include "transaction.h" | 15 | #include "transaction.h" |
15 | #include "transfer.h" | 16 | #include "transfer.h" |
16 | #include "memory.h" | 17 | #include "memory.h" |
17 | #include "budget.h" | 18 | #include "budget.h" |
18 | 19 | ||
19 | class QashMoney : public QWidget | 20 | class QashMoney : public QWidget |
@@ -37,25 +38,27 @@ class QashMoney : public QWidget | |||
37 | void displayDatePreferencesDialog (); | 38 | void displayDatePreferencesDialog (); |
38 | void displayTransactionPreferencesDialog (); | 39 | void displayTransactionPreferencesDialog (); |
39 | void displayAccountPreferencesDialog (); | 40 | void displayAccountPreferencesDialog (); |
40 | void displayMemoryDialog (); | 41 | void displayMemoryDialog (); |
41 | void setTransactionTab (); | 42 | void setTransactionTab (); |
42 | 43 | ||
43 | private slots: | 44 | private slots: |
44 | void changeTabDisplay (); | 45 | void changeTabDisplay (); |
45 | void showTransactions (); | 46 | void showTransactions (); |
46 | void enableOneTouchViewing (); | 47 | void enableOneTouchViewing (); |
47 | void disableOneTouchViewing (); | 48 | void disableOneTouchViewing (); |
48 | void toggleOneTouchViewing ( bool ); | 49 | void toggleOneTouchViewing ( bool ); |
50 | void setTransactionDisplayDate (); | ||
49 | 51 | ||
50 | private: | 52 | private: |
51 | QVBoxLayout *layout; | 53 | QVBoxLayout *layout; |
52 | QVBoxLayout *tabslayout; | 54 | QVBoxLayout *tabslayout; |
53 | AccountDisplay *accountdisplay; | 55 | AccountDisplay *accountdisplay; |
54 | TransactionDisplay *transactiondisplay; | 56 | TransactionDisplay *transactiondisplay; |
55 | BudgetDisplay *budgetdisplay; | 57 | BudgetDisplay *budgetdisplay; |
56 | int tabheight; | 58 | int tabheight; |
59 | QDate newdate; | ||
57 | 60 | ||
58 | }; | 61 | }; |
59 | 62 | ||
60 | #endif | 63 | #endif |
61 | 64 | ||
diff --git a/noncore/apps/qashmoney/qmaccounts.db b/noncore/apps/qashmoney/qmaccounts.db index 449bcab..76db78b 100755 --- a/noncore/apps/qashmoney/qmaccounts.db +++ b/noncore/apps/qashmoney/qmaccounts.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmbudgets.db b/noncore/apps/qashmoney/qmbudgets.db index d798f0c..ef75719 100755 --- a/noncore/apps/qashmoney/qmbudgets.db +++ b/noncore/apps/qashmoney/qmbudgets.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmmemory.db b/noncore/apps/qashmoney/qmmemory.db index 5c23122..c6b7920 100755 --- a/noncore/apps/qashmoney/qmmemory.db +++ b/noncore/apps/qashmoney/qmmemory.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmpreferences.db b/noncore/apps/qashmoney/qmpreferences.db index a4e96f5..91596cb 100755 --- a/noncore/apps/qashmoney/qmpreferences.db +++ b/noncore/apps/qashmoney/qmpreferences.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmtransactions.db b/noncore/apps/qashmoney/qmtransactions.db index 9e4acc9..a5eb4f3 100755 --- a/noncore/apps/qashmoney/qmtransactions.db +++ b/noncore/apps/qashmoney/qmtransactions.db | |||
Binary files differ | |||
diff --git a/noncore/apps/qashmoney/qmtransfers.db b/noncore/apps/qashmoney/qmtransfers.db index c31df1a..3ca9f78 100755 --- a/noncore/apps/qashmoney/qmtransfers.db +++ b/noncore/apps/qashmoney/qmtransfers.db | |||
Binary files differ | |||
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 | |||
@@ -1,22 +1,23 @@ | |||
1 | // RESERVEDONE COLUMN NAME REPRESENTS THE LINEITEMID AND SHOULD BE CHANGED IN | 1 | // RESERVEDONE COLUMN NAME REPRESENTS THE LINEITEMID AND SHOULD BE CHANGED IN |
2 | // FUTURE VERSIONS OF QASHMONEY | 2 | // FUTURE VERSIONS OF QASHMONEY |
3 | 3 | ||
4 | // RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION | 4 | // RESERVEDTWO REPRESENTS THE TRANSACTION DESCRIPTION |
5 | 5 | ||
6 | #include "transaction.h" | 6 | #include "transaction.h" |
7 | #include "account.h" | 7 | #include "account.h" |
8 | #include "transactiondisplay.h" | 8 | #include "transactiondisplay.h" |
9 | 9 | ||
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <iostream.h> | ||
11 | 12 | ||
12 | extern Account *account; | 13 | extern Account *account; |
13 | extern Preferences *preferences; | 14 | extern Preferences *preferences; |
14 | 15 | ||
15 | Transaction::Transaction () | 16 | Transaction::Transaction () |
16 | { | 17 | { |
17 | tdb = sqlite_open ( "qmtransactions.db", 0, NULL ); | 18 | tdb = sqlite_open ( "qmtransactions.db", 0, NULL ); |
18 | } | 19 | } |
19 | 20 | ||
20 | Transaction::~Transaction () | 21 | Transaction::~Transaction () |
21 | { | 22 | { |
22 | sqlite_close ( tdb ); | 23 | sqlite_close ( tdb ); |
@@ -145,60 +146,55 @@ int Transaction::getMonth ( int id ) | |||
145 | QString monthstring = results [ 1 ]; | 146 | QString monthstring = results [ 1 ]; |
146 | return monthstring.toInt(); | 147 | return monthstring.toInt(); |
147 | } | 148 | } |
148 | 149 | ||
149 | int Transaction::getYear ( int id ) | 150 | int Transaction::getYear ( int id ) |
150 | { | 151 | { |
151 | char **results; | 152 | char **results; |
152 | sqlite_get_table_printf ( tdb, "select year from transactions where transid= %i;", &results, NULL, NULL, NULL, id ); | 153 | sqlite_get_table_printf ( tdb, "select year from transactions where transid= %i;", &results, NULL, NULL, NULL, id ); |
153 | QString yearstring = results [ 1 ]; | 154 | QString yearstring = results [ 1 ]; |
154 | return yearstring.toInt(); | 155 | return yearstring.toInt(); |
155 | } | 156 | } |
156 | 157 | ||
157 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit ) | 158 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) |
158 | { | 159 | { |
159 | int showcleared = preferences->getPreference ( 3 ); | 160 | int showcleared = preferences->getPreference ( 3 ); |
161 | int year = ( displaydate.year() ) - 1; | ||
160 | 162 | ||
161 | // select the transactions to display | 163 | // select the transactions to display |
162 | // two different statements are used based on | 164 | // two different statements are used based on |
163 | // whether we are showing cleared transactions | 165 | // whether we are showing cleared transactions |
164 | char **results; | 166 | char **results; |
165 | int rows, columns; | 167 | int rows, columns; |
166 | if ( showcleared == 0 ) | 168 | if ( showcleared == 0 ) |
167 | { | 169 | { |
168 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 170 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) |
169 | 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 ); | 171 | 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 ); |
170 | else | 172 | else |
171 | 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 ); | 173 | 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 ); |
172 | } | 174 | } |
173 | else | 175 | else |
174 | { | 176 | { |
175 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 177 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) |
176 | 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 ); | 178 | 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 ); |
177 | else | 179 | else |
178 | 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 ); | 180 | 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 ); |
179 | } | 181 | } |
180 | 182 | ||
181 | // iterate through the result list and display each item | 183 | // iterate through the result list and display each item |
182 | int counter = 7; | 184 | int counter = 7; |
183 | while ( counter < ( ( rows + 1 ) * columns ) ) | 185 | while ( counter < ( ( rows + 1 ) * columns ) ) |
184 | { | 186 | { |
185 | // construct the date | 187 | QDate displaydate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
186 | //QString daystring = results [ counter ]; | 188 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
187 | //int day = results [ counter ].toInt (); | ||
188 | //QString monthstring = results [ counter + 1 ]; | ||
189 | //int month = results [ counter + 1 ].toInt (); | ||
190 | //QString yearstring = results [ counter + 2 ]; | ||
191 | //int year = results [ counter + 2 ].toInt (); | ||
192 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); | ||
193 | 189 | ||
194 | // construct transaction name, amount, id | 190 | // construct transaction name, amount, id |
195 | QString payee = results [ counter + 3 ]; | 191 | QString payee = results [ counter + 3 ]; |
196 | QString amount = results [ counter + 4 ]; | 192 | QString amount = results [ counter + 4 ]; |
197 | QString transferid = results [ counter + 5 ]; | 193 | QString transferid = results [ counter + 5 ]; |
198 | 194 | ||
199 | //determine the account name of the child accounts that we're displaying | 195 | //determine the account name of the child accounts that we're displaying |
200 | QString accountname = account->getAccountName ( atoi ( results [ counter + 6 ] ) ); | 196 | QString accountname = account->getAccountName ( atoi ( results [ counter + 6 ] ) ); |
201 | 197 | ||
202 | // fill in values | 198 | // fill in values |
203 | if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account | 199 | if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account |
204 | { | 200 | { |
diff --git a/noncore/apps/qashmoney/transaction.h b/noncore/apps/qashmoney/transaction.h index 5db011c..7297bb1 100755 --- a/noncore/apps/qashmoney/transaction.h +++ b/noncore/apps/qashmoney/transaction.h | |||
@@ -1,17 +1,18 @@ | |||
1 | #ifndef TRANSACTION_H | 1 | #ifndef TRANSACTION_H |
2 | #define TRANSACTION_H | 2 | #define TRANSACTION_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qdatetime.h> | ||
6 | #include <sqlite.h> | 7 | #include <sqlite.h> |
7 | 8 | ||
8 | #include "preferences.h" | 9 | #include "preferences.h" |
9 | 10 | ||
10 | class Transaction | 11 | class Transaction |
11 | { | 12 | { |
12 | public: | 13 | public: |
13 | 14 | ||
14 | Transaction (); | 15 | Transaction (); |
15 | ~Transaction (); | 16 | ~Transaction (); |
16 | 17 | ||
17 | // This function adds a new transaction to the database. It takes the payee, accountid, | 18 | // This function adds a new transaction to the database. It takes the payee, accountid, |
@@ -34,25 +35,25 @@ class Transaction | |||
34 | // deletes all transactions for the provided accountid | 35 | // deletes all transactions for the provided accountid |
35 | void deleteAllTransactions ( int accountid ); | 36 | void deleteAllTransactions ( int accountid ); |
36 | 37 | ||
37 | QString getBudgetTotal ( int budgetid, int lineitemid, int year, int month, int viewtype ); | 38 | QString getBudgetTotal ( int budgetid, int lineitemid, int year, int month, int viewtype ); |
38 | QString getActualTotal ( int budgetid, int year, int month, int viewtype ); | 39 | QString getActualTotal ( int budgetid, int year, int month, int viewtype ); |
39 | 40 | ||
40 | // These two functions clear budget ids is either a line item or an entire budget is deleted | 41 | // These two functions clear budget ids is either a line item or an entire budget is deleted |
41 | void clearBudgetIDs ( int, int ); | 42 | void clearBudgetIDs ( int, int ); |
42 | void clearBudgetIDs ( int ); | 43 | void clearBudgetIDs ( int ); |
43 | 44 | ||
44 | public slots: | 45 | public slots: |
45 | 46 | ||
46 | void displayTransactions ( QListView *, int, bool, const char * ); | 47 | void displayTransactions ( QListView *, int, bool, const char *, QDate ); |
47 | QString getPayee ( int ); | 48 | QString getPayee ( int ); |
48 | QString getTransactionDescription ( int ); | 49 | QString getTransactionDescription ( int ); |
49 | QString getNumber ( int ); | 50 | QString getNumber ( int ); |
50 | QString getAmount ( int ); | 51 | QString getAmount ( int ); |
51 | QString getAbsoluteAmount ( int ); | 52 | QString getAbsoluteAmount ( int ); |
52 | int getCleared ( int ); | 53 | int getCleared ( int ); |
53 | void setCleared ( int id, int cleared ); | 54 | void setCleared ( int id, int cleared ); |
54 | int getBudgetID ( int id ); | 55 | int getBudgetID ( int id ); |
55 | int getLineItemID ( int id ); | 56 | int getLineItemID ( int id ); |
56 | int getDay ( int ); | 57 | int getDay ( int ); |
57 | int getMonth ( int ); | 58 | int getMonth ( int ); |
58 | int getYear ( int ); | 59 | int getYear ( int ); |
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index 14f5641..ae6223d 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -118,26 +118,27 @@ void TransactionDisplay::addTransaction () | |||
118 | if ( newtransaction->getDateEdited () == TRUE ) | 118 | if ( newtransaction->getDateEdited () == TRUE ) |
119 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), | 119 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), |
120 | newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(), | 120 | newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(), |
121 | newtransaction->getCurrentLineItem() ); | 121 | newtransaction->getCurrentLineItem() ); |
122 | else | 122 | else |
123 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), | 123 | transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ), |
124 | newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); | 124 | newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); |
125 | 125 | ||
126 | // redisplay transactions | 126 | // redisplay transactions |
127 | listview->clear(); | 127 | listview->clear(); |
128 | QString displaytext = "%"; | 128 | QString displaytext = "%"; |
129 | displaytext.prepend ( limitbox->text() ); | 129 | displaytext.prepend ( limitbox->text() ); |
130 | setTransactionDisplayDate (); | ||
130 | if ( transaction->getNumberOfTransactions() > 0 ) | 131 | if ( transaction->getNumberOfTransactions() > 0 ) |
131 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 132 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
132 | 133 | ||
133 | // redisplay transfers | 134 | // redisplay transfers |
134 | if ( transfer->getNumberOfTransfers() > 0 ) | 135 | if ( transfer->getNumberOfTransfers() > 0 ) |
135 | transfer->displayTransfers ( listview, accountid, children ); | 136 | transfer->displayTransfers ( listview, accountid, children ); |
136 | 137 | ||
137 | // add the transaction amount to the account it's associated with | 138 | // add the transaction amount to the account it's associated with |
138 | // and update its parent account balance if necessary | 139 | // and update its parent account balance if necessary |
139 | account->updateAccountBalance ( accountid ); | 140 | account->updateAccountBalance ( accountid ); |
140 | if ( account->getParentAccountID ( accountid ) != -1 ) | 141 | if ( account->getParentAccountID ( accountid ) != -1 ) |
141 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); | 142 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); |
142 | 143 | ||
143 | // format then reset the account balance | 144 | // format then reset the account balance |
@@ -356,26 +357,27 @@ void TransactionDisplay::editTransaction () | |||
356 | amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem(), transactionid ); | 357 | amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem(), transactionid ); |
357 | 358 | ||
358 | updateAndDisplay ( transaction->getAccountID ( transactionid ) ); | 359 | updateAndDisplay ( transaction->getAccountID ( transactionid ) ); |
359 | } | 360 | } |
360 | } | 361 | } |
361 | 362 | ||
362 | void TransactionDisplay::updateAndDisplay ( int id ) | 363 | void TransactionDisplay::updateAndDisplay ( int id ) |
363 | { | 364 | { |
364 | // redisplay transactions | 365 | // redisplay transactions |
365 | listview->clear(); | 366 | listview->clear(); |
366 | QString displaytext = "%"; | 367 | QString displaytext = "%"; |
367 | displaytext.prepend ( limitbox->text() ); | 368 | displaytext.prepend ( limitbox->text() ); |
369 | setTransactionDisplayDate (); | ||
368 | if ( transaction->getNumberOfTransactions() > 0 ) | 370 | if ( transaction->getNumberOfTransactions() > 0 ) |
369 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 371 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
370 | 372 | ||
371 | // redisplay transfers | 373 | // redisplay transfers |
372 | if ( transfer->getNumberOfTransfers() > 0 ) | 374 | if ( transfer->getNumberOfTransfers() > 0 ) |
373 | transfer->displayTransfers ( listview, accountid, children ); | 375 | transfer->displayTransfers ( listview, accountid, children ); |
374 | 376 | ||
375 | // add the transaction amount to the account it's associated with | 377 | // add the transaction amount to the account it's associated with |
376 | // and update its parent account balance if necessary | 378 | // and update its parent account balance if necessary |
377 | account->updateAccountBalance ( id ); | 379 | account->updateAccountBalance ( id ); |
378 | if ( account->getParentAccountID ( id ) != -1 ) | 380 | if ( account->getParentAccountID ( id ) != -1 ) |
379 | account->changeParentAccountBalance ( account->getParentAccountID ( id ) ); | 381 | account->changeParentAccountBalance ( account->getParentAccountID ( id ) ); |
380 | 382 | ||
381 | // format then reset the account balance | 383 | // format then reset the account balance |
@@ -400,26 +402,27 @@ void TransactionDisplay::deleteTransaction () | |||
400 | // in that case we will have to update balances for the parent | 402 | // in that case we will have to update balances for the parent |
401 | // which is represented by accountid and the child account | 403 | // which is represented by accountid and the child account |
402 | // which will be represented by childaccountid | 404 | // which will be represented by childaccountid |
403 | int childaccountid = -1; | 405 | int childaccountid = -1; |
404 | if ( listview->columns() == 5 ) | 406 | if ( listview->columns() == 5 ) |
405 | childaccountid = transaction->getAccountID ( transactionid ); | 407 | childaccountid = transaction->getAccountID ( transactionid ); |
406 | 408 | ||
407 | transaction->deleteTransaction ( transactionid ); | 409 | transaction->deleteTransaction ( transactionid ); |
408 | 410 | ||
409 | listview->clear(); | 411 | listview->clear(); |
410 | QString displaytext = "%"; | 412 | QString displaytext = "%"; |
411 | displaytext.prepend ( limitbox->text() ); | 413 | displaytext.prepend ( limitbox->text() ); |
414 | setTransactionDisplayDate (); | ||
412 | if ( transaction->getNumberOfTransactions() > 0 ) | 415 | if ( transaction->getNumberOfTransactions() > 0 ) |
413 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 416 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
414 | 417 | ||
415 | if ( transfer->getNumberOfTransfers() > 0 ) | 418 | if ( transfer->getNumberOfTransfers() > 0 ) |
416 | transfer->displayTransfers ( listview, accountid, children ); | 419 | transfer->displayTransfers ( listview, accountid, children ); |
417 | 420 | ||
418 | // if we are viewing different child accounts through the parent account | 421 | // if we are viewing different child accounts through the parent account |
419 | // ie if there are five columns and the parentid is -1 | 422 | // ie if there are five columns and the parentid is -1 |
420 | // update the accountid ( which is the parent ) and update the child account | 423 | // update the accountid ( which is the parent ) and update the child account |
421 | // balance. Get its accountid from the transactionid | 424 | // balance. Get its accountid from the transactionid |
422 | account->updateAccountBalance ( accountid ); // will update either a parent or child | 425 | account->updateAccountBalance ( accountid ); // will update either a parent or child |
423 | if ( account->getParentAccountID ( accountid ) != -1 ) // update its parent if there is one | 426 | if ( account->getParentAccountID ( accountid ) != -1 ) // update its parent if there is one |
424 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); | 427 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); |
425 | if ( childaccountid != -1 ) // we've set childaccountid | 428 | if ( childaccountid != -1 ) // we've set childaccountid |
@@ -431,26 +434,27 @@ void TransactionDisplay::deleteTransaction () | |||
431 | else // takes care of deleting transfers | 434 | else // takes care of deleting transfers |
432 | { | 435 | { |
433 | // get the accountids before we delete the transfer | 436 | // get the accountids before we delete the transfer |
434 | int fromaccountid = transfer->getFromAccountID ( transactionid ); | 437 | int fromaccountid = transfer->getFromAccountID ( transactionid ); |
435 | int toaccountid = transfer->getToAccountID ( transactionid ); | 438 | int toaccountid = transfer->getToAccountID ( transactionid ); |
436 | 439 | ||
437 | // delete the transfer and redisplay transactions | 440 | // delete the transfer and redisplay transactions |
438 | transfer->deleteTransfer ( transactionid ); | 441 | transfer->deleteTransfer ( transactionid ); |
439 | 442 | ||
440 | listview->clear(); | 443 | listview->clear(); |
441 | QString displaytext = "%"; | 444 | QString displaytext = "%"; |
442 | displaytext.prepend ( limitbox->text() ); | 445 | displaytext.prepend ( limitbox->text() ); |
446 | setTransactionDisplayDate (); | ||
443 | if ( transaction->getNumberOfTransactions() > 0 ) | 447 | if ( transaction->getNumberOfTransactions() > 0 ) |
444 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 448 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
445 | 449 | ||
446 | if ( transfer->getNumberOfTransfers() > 0 ) | 450 | if ( transfer->getNumberOfTransfers() > 0 ) |
447 | transfer->displayTransfers ( listview, accountid, children ); | 451 | transfer->displayTransfers ( listview, accountid, children ); |
448 | 452 | ||
449 | // for the from account | 453 | // for the from account |
450 | account->updateAccountBalance ( fromaccountid ); | 454 | account->updateAccountBalance ( fromaccountid ); |
451 | if ( account->getParentAccountID ( fromaccountid ) != -1 ) | 455 | if ( account->getParentAccountID ( fromaccountid ) != -1 ) |
452 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccountid ) ); | 456 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccountid ) ); |
453 | 457 | ||
454 | // for the to account | 458 | // for the to account |
455 | account->updateAccountBalance ( toaccountid ); | 459 | account->updateAccountBalance ( toaccountid ); |
456 | if ( account->getParentAccountID ( toaccountid ) != -1 ) | 460 | if ( account->getParentAccountID ( toaccountid ) != -1 ) |
@@ -483,26 +487,27 @@ void TransactionDisplay::toggleTransaction () | |||
483 | } | 487 | } |
484 | else | 488 | else |
485 | { | 489 | { |
486 | if ( transfer->getCleared ( transactionid ) == 0 ) | 490 | if ( transfer->getCleared ( transactionid ) == 0 ) |
487 | transfer->setCleared ( transactionid, 1 ); | 491 | transfer->setCleared ( transactionid, 1 ); |
488 | else | 492 | else |
489 | transfer->setCleared ( transactionid, 0 ); | 493 | transfer->setCleared ( transactionid, 0 ); |
490 | } | 494 | } |
491 | 495 | ||
492 | listview->clear(); | 496 | listview->clear(); |
493 | QString displaytext = "%"; | 497 | QString displaytext = "%"; |
494 | displaytext.prepend ( limitbox->text() ); | 498 | displaytext.prepend ( limitbox->text() ); |
499 | setTransactionDisplayDate (); | ||
495 | if ( transaction->getNumberOfTransactions() > 0 ) | 500 | if ( transaction->getNumberOfTransactions() > 0 ) |
496 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 501 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
497 | 502 | ||
498 | if ( transfer->getNumberOfTransfers() != 0 ) | 503 | if ( transfer->getNumberOfTransfers() != 0 ) |
499 | transfer->displayTransfers ( listview, accountid, children ); | 504 | transfer->displayTransfers ( listview, accountid, children ); |
500 | } | 505 | } |
501 | 506 | ||
502 | void TransactionDisplay::redisplayAccountBalance () | 507 | void TransactionDisplay::redisplayAccountBalance () |
503 | { | 508 | { |
504 | QString accountbalance = account->getAccountBalance ( accountid ); | 509 | QString accountbalance = account->getAccountBalance ( accountid ); |
505 | balance->setText ( accountbalance ); | 510 | balance->setText ( accountbalance ); |
506 | } | 511 | } |
507 | 512 | ||
508 | void TransactionDisplay::setChildren ( bool c ) | 513 | void TransactionDisplay::setChildren ( bool c ) |
@@ -542,25 +547,28 @@ void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
542 | preferences->changeColumnPreference ( column + 3, newsize ); | 547 | preferences->changeColumnPreference ( column + 3, newsize ); |
543 | else if ( listview->columns() == 5 && column != 4 ) | 548 | else if ( listview->columns() == 5 && column != 4 ) |
544 | preferences->changeColumnPreference ( column + 6, newsize ); | 549 | preferences->changeColumnPreference ( column + 6, newsize ); |
545 | else | 550 | else |
546 | preferences->changeColumnPreference ( 9, newsize ); | 551 | preferences->changeColumnPreference ( 9, newsize ); |
547 | } | 552 | } |
548 | 553 | ||
549 | void TransactionDisplay::limitDisplay ( const QString &text ) | 554 | void TransactionDisplay::limitDisplay ( const QString &text ) |
550 | { | 555 | { |
551 | listview->clear (); | 556 | listview->clear (); |
552 | QString displaytext = "%"; | 557 | QString displaytext = "%"; |
553 | displaytext.prepend ( text ); | 558 | displaytext.prepend ( text ); |
554 | transaction->displayTransactions ( listview, accountid, children, displaytext ); | 559 | setTransactionDisplayDate (); |
560 | if ( transaction->getNumberOfTransactions() > 0 ) | ||
561 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | ||
562 | |||
555 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) | 563 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) |
556 | transfer->displayTransfers ( listview, accountid, children ); | 564 | transfer->displayTransfers ( listview, accountid, children ); |
557 | } | 565 | } |
558 | 566 | ||
559 | int TransactionDisplay::getIDColumn () | 567 | int TransactionDisplay::getIDColumn () |
560 | { | 568 | { |
561 | int counter; | 569 | int counter; |
562 | int columns = listview->columns(); | 570 | int columns = listview->columns(); |
563 | for ( counter = 0; counter <= columns; counter++ ) | 571 | for ( counter = 0; counter <= columns; counter++ ) |
564 | if ( listview->header()->label ( counter ).length() == 0 ) | 572 | if ( listview->header()->label ( counter ).length() == 0 ) |
565 | return counter; | 573 | return counter; |
566 | } | 574 | } |
@@ -575,12 +583,41 @@ void TransactionDisplay::showTransactionNotes () | |||
575 | QDialog *description = new QDialog ( this, "description", TRUE ); | 583 | QDialog *description = new QDialog ( this, "description", TRUE ); |
576 | description->setCaption ( "Notes" ); | 584 | description->setCaption ( "Notes" ); |
577 | QMultiLineEdit *notes = new QMultiLineEdit ( description ); | 585 | QMultiLineEdit *notes = new QMultiLineEdit ( description ); |
578 | notes->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) ); | 586 | notes->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) ); |
579 | notes->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) ); | 587 | notes->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) ); |
580 | notes->setWordWrap ( QMultiLineEdit::WidgetWidth ); | 588 | notes->setWordWrap ( QMultiLineEdit::WidgetWidth ); |
581 | notes->setEnabled ( FALSE ); | 589 | notes->setEnabled ( FALSE ); |
582 | notes->setText ( transaction->getTransactionDescription ( transactionid ) ); | 590 | notes->setText ( transaction->getTransactionDescription ( transactionid ) ); |
583 | description->show(); | 591 | description->show(); |
584 | } | 592 | } |
585 | } | 593 | } |
586 | 594 | ||
595 | void TransactionDisplay::setTransactionDisplayDate () | ||
596 | { | ||
597 | // determine how many days of transactions to show | ||
598 | int limittype = preferences->getPreference ( 7 ); | ||
599 | if ( limittype != 5 ) // set today's date if we are not showing all transactions | ||
600 | { | ||
601 | QDate today = QDate::currentDate (); | ||
602 | switch ( limittype ) // if we are not showing all transactions | ||
603 | { | ||
604 | case 0: // viewing two weeks | ||
605 | displaydate = today.addDays ( -14 ); | ||
606 | break; | ||
607 | case 1: // viewing one month | ||
608 | displaydate = today.addDays ( -30 ); | ||
609 | break; | ||
610 | case 2: // three months | ||
611 | displaydate = today.addDays ( -90 ); | ||
612 | break; | ||
613 | case 3: // six months | ||
614 | displaydate = today.addDays ( -180 ); | ||
615 | break; | ||
616 | case 4: // one year | ||
617 | displaydate = today.addDays ( -365 ); | ||
618 | break; | ||
619 | } | ||
620 | } | ||
621 | else | ||
622 | displaydate = QDate ( 1, 1, 1000 ); | ||
623 | } | ||
diff --git a/noncore/apps/qashmoney/transactiondisplay.h b/noncore/apps/qashmoney/transactiondisplay.h index 79f20ba..1746f6c 100755 --- a/noncore/apps/qashmoney/transactiondisplay.h +++ b/noncore/apps/qashmoney/transactiondisplay.h | |||
@@ -1,21 +1,22 @@ | |||
1 | #ifndef TRANSACTIONDISPLAY_H | 1 | #ifndef TRANSACTIONDISPLAY_H |
2 | #define TRANSACTIONDISPLAY_H | 2 | #define TRANSACTIONDISPLAY_H |
3 | 3 | ||
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | #include <qhbox.h> | 5 | #include <qhbox.h> |
6 | #include <qlistview.h> | 6 | #include <qlistview.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qlabel.h> | 8 | #include <qlabel.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qdatetime.h> | ||
10 | 11 | ||
11 | class TransactionDisplay : public QWidget | 12 | class TransactionDisplay : public QWidget |
12 | { | 13 | { |
13 | Q_OBJECT | 14 | Q_OBJECT |
14 | 15 | ||
15 | public: | 16 | public: |
16 | TransactionDisplay ( QWidget* parent ); | 17 | TransactionDisplay ( QWidget* parent ); |
17 | 18 | ||
18 | QListView* listview; | 19 | QListView* listview; |
19 | QPushButton* newtransaction; | 20 | QPushButton* newtransaction; |
20 | QPushButton* edittransaction; | 21 | QPushButton* edittransaction; |
21 | QPushButton* deletetransaction; | 22 | QPushButton* deletetransaction; |
@@ -39,27 +40,29 @@ class TransactionDisplay : public QWidget | |||
39 | void addTransaction (); | 40 | void addTransaction (); |
40 | void editTransaction (); | 41 | void editTransaction (); |
41 | void editTransfer (); | 42 | void editTransfer (); |
42 | void deleteTransaction (); | 43 | void deleteTransaction (); |
43 | void toggleTransaction (); | 44 | void toggleTransaction (); |
44 | void checkListViewDelete (); | 45 | void checkListViewDelete (); |
45 | void checkListViewEdit (); | 46 | void checkListViewEdit (); |
46 | void checkListViewToggle (); | 47 | void checkListViewToggle (); |
47 | void saveColumnSize ( int column, int oldsize, int newsize ); | 48 | void saveColumnSize ( int column, int oldsize, int newsize ); |
48 | void limitDisplay ( const QString & ); | 49 | void limitDisplay ( const QString & ); |
49 | void showCalculator (); | 50 | void showCalculator (); |
50 | void showCalendar (); | 51 | void showCalendar (); |
52 | void setTransactionDisplayDate (); | ||
51 | 53 | ||
52 | private: | 54 | private: |
53 | int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; | 55 | int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; |
56 | QDate displaydate; | ||
54 | bool children; | 57 | bool children; |
55 | QBoxLayout *layout; | 58 | QBoxLayout *layout; |
56 | QHBox *firstline; | 59 | QHBox *firstline; |
57 | QHBox *secondline; | 60 | QHBox *secondline; |
58 | void redisplayAccountBalance (); | 61 | void redisplayAccountBalance (); |
59 | void updateAndDisplay ( int accountid ); | 62 | void updateAndDisplay ( int accountid ); |
60 | }; | 63 | }; |
61 | 64 | ||
62 | #endif | 65 | #endif |
63 | 66 | ||
64 | #ifndef COLORLISTITEM_H | 67 | #ifndef COLORLISTITEM_H |
65 | #define COLORLISTITEM_H | 68 | #define COLORLISTITEM_H |