author | allenforsythe <allenforsythe> | 2003-05-28 11:49:47 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-28 11:49:47 (UTC) |
commit | 52047fd3d3f30509d65834747c3a0c5c6760dc01 (patch) (unidiff) | |
tree | 136945c2ffff2434ba1e3c8959b5335f5016e8f8 | |
parent | 7c85b3e98921afa74c7c6a90da4dfd54631c89c5 (diff) | |
download | opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.zip opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.gz opie-52047fd3d3f30509d65834747c3a0c5c6760dc01.tar.bz2 |
*** empty log message ***
-rwxr-xr-x | noncore/apps/qashmoney/CHANGES | 8 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/README | 35 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/account.cpp | 9 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.cpp | 19 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/accountdisplay.h | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budget.cpp | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.cpp | 12 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.h | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | 5 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.cpp | 50 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/qashmoney.cpp | 23 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.cpp | 122 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transaction.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.cpp | 20 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transactiondisplay.h | 1 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transfer.cpp | 61 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transfer.h | 3 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/transferdialog.cpp | 2 |
19 files changed, 276 insertions, 105 deletions
diff --git a/noncore/apps/qashmoney/CHANGES b/noncore/apps/qashmoney/CHANGES index f17035b..a3ac224 100755 --- a/noncore/apps/qashmoney/CHANGES +++ b/noncore/apps/qashmoney/CHANGES | |||
@@ -1,16 +1,24 @@ | |||
1 | QashMoney - Budget Software for the Sharp Zaurus | 1 | QashMoney - Budget Software for the Sharp Zaurus |
2 | 2 | ||
3 | CHANGES | 3 | CHANGES |
4 | 4 | ||
5 | 0.76 - 5/21/03 | ||
6 | |||
7 | Updated postinst file so app will install on new Sharp ROM 3.1 | ||
8 | Improved algorithm for selecting cleared transaction | ||
9 | Fixed budget display bug | ||
10 | |||
11 | ---------------------------------------------------------------------------------- | ||
12 | |||
5 | 11/1/02 - Initial release of 0.2 version. Considered stable beta version. | 13 | 11/1/02 - Initial release of 0.2 version. Considered stable beta version. |
6 | 11/16/02 - Release of version 0.3. This is a stable version adding function to | 14 | 11/16/02 - Release of version 0.3. This is a stable version adding function to |
7 | transfer money between accounts. Several bugs fixes and speed enhancements | 15 | transfer money between accounts. Several bugs fixes and speed enhancements |
8 | have been done. | 16 | have been done. |
9 | 11/21/02 - 0.31 news tabs working but not yet displaying accounts | 17 | 11/21/02 - 0.31 news tabs working but not yet displaying accounts |
10 | 12/15/02 - QashMoney gets a complete face lift and now has a date picker. | 18 | 12/15/02 - QashMoney gets a complete face lift and now has a date picker. |
11 | 12/29/02 - Version 0.41 released. This release fixes more bugs and adds a | 19 | 12/29/02 - Version 0.41 released. This release fixes more bugs and adds a |
12 | function to manage transaction memory items. | 20 | function to manage transaction memory items. |
13 | 12/31/02 - Version 0.42 released. Maintenance release fixing soem rather nasty | 21 | 12/31/02 - Version 0.42 released. Maintenance release fixing soem rather nasty |
14 | bugs that screw up account, transaction, and transfer displays. | 22 | bugs that screw up account, transaction, and transfer displays. |
15 | 03/03/03 - Version 0.60 released. QashMoney has undergone quite a transformation. | 23 | 03/03/03 - Version 0.60 released. QashMoney has undergone quite a transformation. |
16 | A new GUI that incorporates all of Qts excellent layout capabilities should | 24 | A new GUI that incorporates all of Qts excellent layout capabilities should |
diff --git a/noncore/apps/qashmoney/README b/noncore/apps/qashmoney/README index 1888ce6..ef004f7 100755 --- a/noncore/apps/qashmoney/README +++ b/noncore/apps/qashmoney/README | |||
@@ -1,45 +1,39 @@ | |||
1 | QashMoney - Budget Software for the Sharp Zaurus | 1 | QashMoney - Budget Software for the Sharp Zaurus |
2 | 2 | ||
3 | README | 3 | README |
4 | 4 | ||
5 | Welcome to the latest version of QashMoney! This app is designed to make your | ||
6 | budgeting fast, inuitive and easy. | ||
7 | |||
8 | This file lists all the important files in the qashmoney CVS directory and how | 5 | This file lists all the important files in the qashmoney CVS directory and how |
9 | to make the IPK file that goes on the Zaurus. When you checkout the | 6 | to make the IPK file that goes on the Zaurus. When you checkout the |
10 | qashmoney module from CVS, it will create a directory on your hard drive called | 7 | qashmoney-source module from CVS, it will create a directory on your hard drive called |
11 | qashmoney. These instructions assume you are in the directory. | 8 | qashmoney-source. These instructions assume you are in this directory. |
12 | 9 | ||
13 | The first thing you need to do is have all the necessary cross-compile software | 10 | The first thing you need to do is have all the necessary cross-compile software |
14 | and Qtopia installed on your system. I assume you have already done this since | 11 | and Qtopia installed on your system. I assume you have already done this since |
15 | you are downloading CVS, but if not, go to: | 12 | you are downloading CVS, but if not, go to: |
16 | 13 | ||
17 | http://docs.zaurus.com | 14 | http://docs.zaurus.com |
18 | 15 | ||
19 | and download the RPMS that you need for development. | 16 | and download the RPMS that you need for development. |
20 | 17 | ||
21 | You also must have sqlite installed on your system to successfully compile | 18 | You also must have sqlite installed on your system to successfully compile |
22 | QashMoney. Go to: | 19 | QashMoney. Go to: |
23 | 20 | ||
24 | http://www.sqlite.org | 21 | http://www.sqlite.org |
25 | 22 | ||
26 | to download this progam. The SQLite library has already been compiled for the | 23 | to download this progam. |
27 | IPK and is in the 'install' directory. So there is no need to compile SQLite | ||
28 | for ARM but you can if you want. There are instructions for that on the | ||
29 | website. | ||
30 | 24 | ||
31 | After that, set the correct environment variables for the package you | 25 | After that, set the correct environment variables for the package you |
32 | are developing.Two scripts in the qashmoney are used for that purpose: x86.sh | 26 | are developing. Two scripts in the qashmoney-source directory are used for that purpose: x86.sh |
33 | andarm.shIf you are buidling for x86 type: | 27 | and arm.sh. If you are building for x86 type: |
34 | 28 | ||
35 | source x86.sh | 29 | source x86.sh |
36 | 30 | ||
37 | and press enter. To make binaries that run on the Zaurus, type: | 31 | and press enter. To make binaries that run on the Zaurus, type: |
38 | 32 | ||
39 | source arm.sh | 33 | source arm.sh |
40 | 34 | ||
41 | Next, construct the makefile by typing: | 35 | Next, construct the makefile by typing: |
42 | 36 | ||
43 | tmake -o Makefile qashmoney.pro | 37 | tmake -o Makefile qashmoney.pro |
44 | 38 | ||
45 | tmake is Trolltech's program for constructing a typical GNU Makefile from the | 39 | tmake is Trolltech's program for constructing a typical GNU Makefile from the |
@@ -54,41 +48,24 @@ binary in this directory. If you compiled for x86, you can see the application | |||
54 | by using the Qt Virtual Frame Buffer which emulates the Qtopia environment on | 48 | by using the Qt Virtual Frame Buffer which emulates the Qtopia environment on |
55 | your computer. First, copy all the files from the databasefiles directory within the | 49 | your computer. First, copy all the files from the databasefiles directory within the |
56 | qashmoney directory. Otherwise, the program will not function. | 50 | qashmoney directory. Otherwise, the program will not function. |
57 | 51 | ||
58 | To run QashMoney in the Qtopia Virtual Frame Buffer, type: | 52 | To run QashMoney in the Qtopia Virtual Frame Buffer, type: |
59 | 53 | ||
60 | qvfb & | 54 | qvfb & |
61 | ./qashmoney -qws | 55 | ./qashmoney -qws |
62 | 56 | ||
63 | and QashMoney should appear in the frambuffer. You can use and test qashmoney | 57 | and QashMoney should appear in the frambuffer. You can use and test qashmoney |
64 | here as you would on the Zaurus. | 58 | here as you would on the Zaurus. |
65 | 59 | ||
66 | If you compile the binary file for the Zaurus, another script in this directory | 60 | If you want to compile the app and make the IPK file, check out the qashmoney-build module and see the README file in that module. |
67 | will come in handy. To automagically make the IPK file, type: | ||
68 | |||
69 | su | ||
70 | ./make_ipk | ||
71 | |||
72 | You need to be the root user to set the ownership of the binary and other | ||
73 | files correctly. The IPK file will appear in the qashmoney directory. Now put | ||
74 | this file onto the Zaurus and install! | ||
75 | |||
76 | Two other scripts in the directory may be of use. The make_x86 script cleans | ||
77 | the directory and makes the x86 qashmoney binary automatically. The make_arm | ||
78 | scripts makes the ARM binary. So you should really only have to type three | ||
79 | commands the make the IPK file: | ||
80 | |||
81 | ./make_arm | ||
82 | su | ||
83 | ./make_ipk | ||
84 | 61 | ||
85 | I hope the program can be useful. If you have any questions or comments, please | 62 | I hope the program can be useful. If you have any questions or comments, please |
86 | contact me at qashmoneyman@attbi.com | 63 | contact me at qashmoneyman@attbi.com |
87 | 64 | ||
88 | Thanks! | 65 | Thanks! |
89 | 66 | ||
90 | Allen | 67 | Allen |
91 | 68 | ||
92 | Disclaimer: Altough I've tried to make this application tight and well | 69 | Disclaimer: Altough I've tried to make this application tight and well |
93 | functioning, it comes with absolutely no warranty and I will not be liable for | 70 | functioning, it comes with absolutely no warranty and I will not be liable for |
94 | any damage it may cause. | 71 | any damage it may cause. |
diff --git a/noncore/apps/qashmoney/account.cpp b/noncore/apps/qashmoney/account.cpp index fc2f8c1..28f9ba2 100755 --- a/noncore/apps/qashmoney/account.cpp +++ b/noncore/apps/qashmoney/account.cpp | |||
@@ -13,27 +13,26 @@ Account::Account () | |||
13 | { | 13 | { |
14 | adb = sqlite_open ( "qmaccounts.db", 0, NULL ); | 14 | adb = sqlite_open ( "qmaccounts.db", 0, NULL ); |
15 | } | 15 | } |
16 | 16 | ||
17 | Account::~Account () | 17 | Account::~Account () |
18 | { | 18 | { |
19 | sqlite_close ( adb ); | 19 | sqlite_close ( adb ); |
20 | } | 20 | } |
21 | 21 | ||
22 | void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit, | 22 | void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit, |
23 | int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) | 23 | int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency ) |
24 | { | 24 | { |
25 | int r = sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0, | 25 | sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0, |
26 | (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency ); | 26 | (const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency ); |
27 | cout << "Results = " << r << endl; | ||
28 | } | 27 | } |
29 | 28 | ||
30 | void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid ) | 29 | void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid ) |
31 | { | 30 | { |
32 | sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid ); | 31 | sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid ); |
33 | } | 32 | } |
34 | 33 | ||
35 | void Account::deleteAccount ( int accountid ) | 34 | void Account::deleteAccount ( int accountid ) |
36 | { | 35 | { |
37 | sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid ); | 36 | sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid ); |
38 | } | 37 | } |
39 | 38 | ||
@@ -216,24 +215,30 @@ void Account::displayAccounts ( QListView *listview ) | |||
216 | listview->setColumnWidthMode ( 2, QListView::Manual ); | 215 | listview->setColumnWidthMode ( 2, QListView::Manual ); |
217 | } | 216 | } |
218 | else | 217 | else |
219 | { | 218 | { |
220 | listview->setColumnWidth ( 0, preferences->getColumnPreference ( 10 ) ); | 219 | listview->setColumnWidth ( 0, preferences->getColumnPreference ( 10 ) ); |
221 | listview->setColumnWidthMode ( 0, QListView::Manual ); | 220 | listview->setColumnWidthMode ( 0, QListView::Manual ); |
222 | listview->setColumnWidth ( 1, preferences->getColumnPreference ( 11 ) ); | 221 | listview->setColumnWidth ( 1, preferences->getColumnPreference ( 11 ) ); |
223 | listview->setColumnWidthMode ( 1, QListView::Manual ); | 222 | listview->setColumnWidthMode ( 1, QListView::Manual ); |
224 | listview->setColumnWidth ( 2, preferences->getColumnPreference ( 12 ) ); | 223 | listview->setColumnWidth ( 2, preferences->getColumnPreference ( 12 ) ); |
225 | listview->setColumnWidthMode ( 2, QListView::Manual ); | 224 | listview->setColumnWidthMode ( 2, QListView::Manual ); |
226 | listview->setColumnWidthMode ( 3, QListView::Manual ); | 225 | listview->setColumnWidthMode ( 3, QListView::Manual ); |
227 | } | 226 | } |
227 | |||
228 | // Now reset the column sorting to user preference | ||
229 | int column = 0; | ||
230 | int direction = 0; | ||
231 | preferences->getSortingPreference ( 1, &column, &direction ); | ||
232 | listview->setSorting ( column, direction ); | ||
228 | } | 233 | } |
229 | 234 | ||
230 | int Account::displayParentAccountNames ( QComboBox *combobox, QString indexstring ) | 235 | int Account::displayParentAccountNames ( QComboBox *combobox, QString indexstring ) |
231 | { | 236 | { |
232 | char **results; | 237 | char **results; |
233 | int rows, columns, index; | 238 | int rows, columns, index; |
234 | index = 0; | 239 | index = 0; |
235 | sqlite_get_table ( adb, "select name from accounts2 order by name asc;", &results, &rows, &columns, NULL ); | 240 | sqlite_get_table ( adb, "select name from accounts2 order by name asc;", &results, &rows, &columns, NULL ); |
236 | int counter = 1; | 241 | int counter = 1; |
237 | int indexcounter = 1; | 242 | int indexcounter = 1; |
238 | int total = ( rows + 1 ) * columns; | 243 | int total = ( rows + 1 ) * columns; |
239 | while ( counter < total ) | 244 | while ( counter < total ) |
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp index b2c0838..64f4ea8 100755 --- a/noncore/apps/qashmoney/accountdisplay.cpp +++ b/noncore/apps/qashmoney/accountdisplay.cpp | |||
@@ -1,15 +1,16 @@ | |||
1 | #include <qdatetime.h> | 1 | #include <qdatetime.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <iostream.h> | ||
4 | 5 | ||
5 | #include "accountdisplay.h" | 6 | #include "accountdisplay.h" |
6 | #include "newaccount.h" | 7 | #include "newaccount.h" |
7 | #include "transaction.h" | 8 | #include "transaction.h" |
8 | #include "transferdialog.h" | 9 | #include "transferdialog.h" |
9 | #include "preferences.h" | 10 | #include "preferences.h" |
10 | #include "transfer.h" | 11 | #include "transfer.h" |
11 | 12 | ||
12 | extern Account *account; | 13 | extern Account *account; |
13 | extern Transaction *transaction; | 14 | extern Transaction *transaction; |
14 | extern Transfer *transfer; | 15 | extern Transfer *transfer; |
15 | extern Preferences *preferences; | 16 | extern Preferences *preferences; |
@@ -36,28 +37,29 @@ AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent ) | |||
36 | transferbutton = new QPushButton ( firstline ); | 37 | transferbutton = new QPushButton ( firstline ); |
37 | transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); | 38 | transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") ); |
38 | transferbutton->setToggleButton ( TRUE ); | 39 | transferbutton->setToggleButton ( TRUE ); |
39 | connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); | 40 | connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) ); |
40 | 41 | ||
41 | listview = new QListView ( this ); | 42 | listview = new QListView ( this ); |
42 | listview->setAllColumnsShowFocus ( TRUE ); | 43 | listview->setAllColumnsShowFocus ( TRUE ); |
43 | listview->setShowSortIndicator ( TRUE ); | 44 | listview->setShowSortIndicator ( TRUE ); |
44 | listview->setRootIsDecorated ( TRUE ); | 45 | listview->setRootIsDecorated ( TRUE ); |
45 | listview->setMultiSelection ( FALSE ); | 46 | listview->setMultiSelection ( FALSE ); |
46 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); | 47 | connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) ); |
47 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); | 48 | connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) ); |
48 | 49 | ||
49 | listview->header()->setTracking ( FALSE ); | 50 | listview->header()->setTracking ( FALSE ); |
50 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 51 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
51 | 52 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | |
53 | |||
52 | layout = new QVBoxLayout ( this, 2, 5 ); | 54 | layout = new QVBoxLayout ( this, 2, 5 ); |
53 | layout->addWidget ( firstline ); | 55 | layout->addWidget ( firstline ); |
54 | layout->addWidget ( listview ); | 56 | layout->addWidget ( listview ); |
55 | } | 57 | } |
56 | 58 | ||
57 | void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) | 59 | void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs ) |
58 | { | 60 | { |
59 | tab2 = newtab2; | 61 | tab2 = newtab2; |
60 | maintabs = newtabs; | 62 | maintabs = newtabs; |
61 | } | 63 | } |
62 | 64 | ||
63 | void AccountDisplay::addAccount () | 65 | void AccountDisplay::addAccount () |
@@ -259,32 +261,30 @@ void AccountDisplay::getTransferAccounts ( QListViewItem * item ) | |||
259 | // enter today's date in the date box as default | 261 | // enter today's date in the date box as default |
260 | QDate today = QDate::currentDate (); | 262 | QDate today = QDate::currentDate (); |
261 | int defaultday = today.day(); | 263 | int defaultday = today.day(); |
262 | int defaultmonth = today.month(); | 264 | int defaultmonth = today.month(); |
263 | int defaultyear = today.year(); | 265 | int defaultyear = today.year(); |
264 | td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); | 266 | td->date->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) ); |
265 | 267 | ||
266 | if ( td->exec() == QDialog::Accepted ) | 268 | if ( td->exec() == QDialog::Accepted ) |
267 | { | 269 | { |
268 | // set the cleared integer if the checkbox is checked | 270 | // set the cleared integer if the checkbox is checked |
269 | if ( td->clearedcheckbox->isChecked() == TRUE ) | 271 | if ( td->clearedcheckbox->isChecked() == TRUE ) |
270 | cleared = 1; | 272 | cleared = 1; |
271 | 273 | cout << "Year from transferdialog = " << td->getYear() << endl; | |
272 | // add the transfer with a new date if its been edited or use the default date | 274 | // add the transfer with a new date if its been edited or use the default date |
273 | if ( td->getDateEdited () == TRUE ) | 275 | if ( td->getDateEdited () == TRUE ) |
274 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, | 276 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); |
275 | account->getParentAccountID ( secondaccountid ), td->getDay(), td->getMonth(), td->getYear(), td->amount->text().toFloat(), cleared ); | ||
276 | else | 277 | else |
277 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, | 278 | transfer->addTransfer ( firstaccountid, account->getParentAccountID ( firstaccountid ), secondaccountid, account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); |
278 | account->getParentAccountID ( secondaccountid ), defaultday, defaultmonth, defaultyear, td->amount->text().toFloat(), cleared ); | ||
279 | 279 | ||
280 | // update account balances of both accounts and parents if necessary | 280 | // update account balances of both accounts and parents if necessary |
281 | account->updateAccountBalance ( firstaccountid ); | 281 | account->updateAccountBalance ( firstaccountid ); |
282 | if ( account->getParentAccountID ( firstaccountid ) != -1 ) | 282 | if ( account->getParentAccountID ( firstaccountid ) != -1 ) |
283 | account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); | 283 | account->changeParentAccountBalance ( account->getParentAccountID ( firstaccountid ) ); |
284 | account->updateAccountBalance ( secondaccountid ); | 284 | account->updateAccountBalance ( secondaccountid ); |
285 | if ( account->getParentAccountID ( secondaccountid ) != -1 ) | 285 | if ( account->getParentAccountID ( secondaccountid ) != -1 ) |
286 | account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); | 286 | account->changeParentAccountBalance ( account->getParentAccountID ( secondaccountid ) ); |
287 | 287 | ||
288 | // redisplay accounts | 288 | // redisplay accounts |
289 | account->displayAccounts ( listview ); | 289 | account->displayAccounts ( listview ); |
290 | } | 290 | } |
@@ -338,24 +338,29 @@ void AccountDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
338 | if ( listview->columns() == 3 ) | 338 | if ( listview->columns() == 3 ) |
339 | preferences->changeColumnPreference ( 2, newsize ); | 339 | preferences->changeColumnPreference ( 2, newsize ); |
340 | else | 340 | else |
341 | preferences->changeColumnPreference ( 11, newsize ); | 341 | preferences->changeColumnPreference ( 11, newsize ); |
342 | break; | 342 | break; |
343 | case 2: | 343 | case 2: |
344 | preferences->changeColumnPreference ( 12, newsize ); | 344 | preferences->changeColumnPreference ( 12, newsize ); |
345 | break; | 345 | break; |
346 | } | 346 | } |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | void AccountDisplay::saveSortingPreference ( int column ) | ||
351 | { | ||
352 | preferences->changeSortingPreference ( 1, column ); | ||
353 | } | ||
354 | |||
350 | int AccountDisplay::getIDColumn () | 355 | int AccountDisplay::getIDColumn () |
351 | { | 356 | { |
352 | int counter; | 357 | int counter; |
353 | int columns = listview->columns(); | 358 | int columns = listview->columns(); |
354 | for ( counter = 0; counter <= columns; counter++ ) | 359 | for ( counter = 0; counter <= columns; counter++ ) |
355 | if ( listview->header()->label ( counter ).length() == 0 ) | 360 | if ( listview->header()->label ( counter ).length() == 0 ) |
356 | return counter; | 361 | return counter; |
357 | } | 362 | } |
358 | 363 | ||
359 | void AccountDisplay::editAccount () | 364 | void AccountDisplay::editAccount () |
360 | { | 365 | { |
361 | if ( listview->selectedItem() == 0 ) | 366 | if ( listview->selectedItem() == 0 ) |
diff --git a/noncore/apps/qashmoney/accountdisplay.h b/noncore/apps/qashmoney/accountdisplay.h index 37bcb34..6d67b9b 100755 --- a/noncore/apps/qashmoney/accountdisplay.h +++ b/noncore/apps/qashmoney/accountdisplay.h | |||
@@ -33,21 +33,22 @@ class AccountDisplay : public QWidget | |||
33 | void addAccount (); | 33 | void addAccount (); |
34 | void editAccount (); | 34 | void editAccount (); |
35 | void deleteAccount (); | 35 | void deleteAccount (); |
36 | void accountTransfer ( bool state ); | 36 | void accountTransfer ( bool state ); |
37 | void getTransferAccounts ( QListViewItem * item ); | 37 | void getTransferAccounts ( QListViewItem * item ); |
38 | void disableParentsWithChildren (); | 38 | void disableParentsWithChildren (); |
39 | void enableAccounts (); | 39 | void enableAccounts (); |
40 | 40 | ||
41 | private slots: | 41 | private slots: |
42 | void saveColumnSize ( int column, int oldsize, int newsize ); | 42 | void saveColumnSize ( int column, int oldsize, int newsize ); |
43 | void setAccountExpanded ( QListViewItem *item ); | 43 | void setAccountExpanded ( QListViewItem *item ); |
44 | void setAccountCollapsed ( QListViewItem *item ); | 44 | void setAccountCollapsed ( QListViewItem *item ); |
45 | void saveSortingPreference ( int column ); | ||
45 | 46 | ||
46 | private: | 47 | private: |
47 | int type, firstaccountid, secondaccountid, cleared; | 48 | int type, firstaccountid, secondaccountid, cleared; |
48 | QWidget *tab2; | 49 | QWidget *tab2; |
49 | QTabWidget *maintabs; | 50 | QTabWidget *maintabs; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif // ACCOUNTDISPLAY_H | 53 | #endif // ACCOUNTDISPLAY_H |
53 | 54 | ||
diff --git a/noncore/apps/qashmoney/budget.cpp b/noncore/apps/qashmoney/budget.cpp index 42f7eca..9f74078 100755 --- a/noncore/apps/qashmoney/budget.cpp +++ b/noncore/apps/qashmoney/budget.cpp | |||
@@ -1,15 +1,16 @@ | |||
1 | #include "budget.h" | 1 | #include "budget.h" |
2 | #include "transaction.h" | 2 | #include "transaction.h" |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <iostream.h> | ||
4 | 5 | ||
5 | extern Transaction *transaction; | 6 | extern Transaction *transaction; |
6 | 7 | ||
7 | Budget::Budget () | 8 | Budget::Budget () |
8 | { | 9 | { |
9 | bdb = sqlite_open ( "qmbudgets.db", 0, NULL ); | 10 | bdb = sqlite_open ( "qmbudgets.db", 0, NULL ); |
10 | } | 11 | } |
11 | 12 | ||
12 | Budget::~Budget () | 13 | Budget::~Budget () |
13 | { | 14 | { |
14 | sqlite_close ( bdb ); | 15 | sqlite_close ( bdb ); |
15 | } | 16 | } |
@@ -53,25 +54,25 @@ int Budget::getNumberOfLineItems ( int budgetid ) | |||
53 | QString tablename = "table"; | 54 | QString tablename = "table"; |
54 | tablename.append ( QString::number ( budgetid ) ); | 55 | tablename.append ( QString::number ( budgetid ) ); |
55 | char **results; | 56 | char **results; |
56 | sqlite_get_table_printf ( bdb, "select count() from '%q';", &results, NULL, NULL, NULL, ( const char * ) tablename ); | 57 | sqlite_get_table_printf ( bdb, "select count() from '%q';", &results, NULL, NULL, NULL, ( const char * ) tablename ); |
57 | return atoi ( results [ 1 ] ); | 58 | return atoi ( results [ 1 ] ); |
58 | } | 59 | } |
59 | 60 | ||
60 | QStringList* Budget::getBudgetNames () | 61 | QStringList* Budget::getBudgetNames () |
61 | { | 62 | { |
62 | QStringList *names = new QStringList (); | 63 | QStringList *names = new QStringList (); |
63 | char **results; | 64 | char **results; |
64 | int rows, counter; | 65 | int rows, counter; |
65 | sqlite_get_table ( bdb, "select name from budgets order by name asc;", &results, &rows, NULL, NULL ); | 66 | sqlite_get_table ( bdb, "select name from budgets;", &results, &rows, NULL, NULL ); |
66 | names->append ( "None" ); | 67 | names->append ( "None" ); |
67 | for ( counter = 0; counter < rows; counter++ ) | 68 | for ( counter = 0; counter < rows; counter++ ) |
68 | names->append ( results [ counter+1 ] ); | 69 | names->append ( results [ counter+1 ] ); |
69 | return names; | 70 | return names; |
70 | } | 71 | } |
71 | 72 | ||
72 | QString Budget::getBudgetName ( int budgetid ) | 73 | QString Budget::getBudgetName ( int budgetid ) |
73 | { | 74 | { |
74 | char **results; | 75 | char **results; |
75 | sqlite_get_table_printf ( bdb, "select name from budgets where budgetid= %i;", &results, NULL, NULL, NULL, budgetid ); | 76 | sqlite_get_table_printf ( bdb, "select name from budgets where budgetid= %i;", &results, NULL, NULL, NULL, budgetid ); |
76 | return ( QString ) results [ 1 ]; | 77 | return ( QString ) results [ 1 ]; |
77 | } | 78 | } |
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp index 09f62b2..afc6a2d 100755 --- a/noncore/apps/qashmoney/budgetdisplay.cpp +++ b/noncore/apps/qashmoney/budgetdisplay.cpp | |||
@@ -73,24 +73,31 @@ BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) | |||
73 | listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 | 73 | listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 |
74 | listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 | 74 | listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 |
75 | listview->addColumn ( "", 0 ); // line item ids | 75 | listview->addColumn ( "", 0 ); // line item ids |
76 | listview->setColumnWidthMode ( 0, QListView::Manual ); | 76 | listview->setColumnWidthMode ( 0, QListView::Manual ); |
77 | listview->setColumnWidthMode ( 1, QListView::Manual ); | 77 | listview->setColumnWidthMode ( 1, QListView::Manual ); |
78 | listview->setColumnWidthMode ( 2, QListView::Manual ); | 78 | listview->setColumnWidthMode ( 2, QListView::Manual ); |
79 | listview->setColumnAlignment ( 1, Qt::AlignRight ); | 79 | listview->setColumnAlignment ( 1, Qt::AlignRight ); |
80 | listview->setColumnAlignment ( 2, Qt::AlignRight ); | 80 | listview->setColumnAlignment ( 2, Qt::AlignRight ); |
81 | listview->setColumnWidthMode ( 3, QListView::Manual ); | 81 | listview->setColumnWidthMode ( 3, QListView::Manual ); |
82 | 82 | ||
83 | listview->header()->setTracking ( FALSE ); | 83 | listview->header()->setTracking ( FALSE ); |
84 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 84 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
85 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | ||
86 | |||
87 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | ||
88 | int column = 0; | ||
89 | int direction = 0; | ||
90 | preferences->getSortingPreference ( 3, &column, &direction ); | ||
91 | listview->setSorting ( column, direction ); | ||
85 | 92 | ||
86 | displayBudgetNames(); | 93 | displayBudgetNames(); |
87 | 94 | ||
88 | layout = new QVBoxLayout ( this, 2, 2 ); | 95 | layout = new QVBoxLayout ( this, 2, 2 ); |
89 | layout->setMenuBar ( menu ); | 96 | layout->setMenuBar ( menu ); |
90 | layout->addWidget ( firstline ); | 97 | layout->addWidget ( firstline ); |
91 | layout->addWidget ( secondline ); | 98 | layout->addWidget ( secondline ); |
92 | layout->addWidget ( listview ); | 99 | layout->addWidget ( listview ); |
93 | } | 100 | } |
94 | 101 | ||
95 | void BudgetDisplay::deleteBudget () | 102 | void BudgetDisplay::deleteBudget () |
96 | { | 103 | { |
@@ -109,24 +116,29 @@ void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
109 | case 0: | 116 | case 0: |
110 | preferences->changeColumnPreference ( 13, newsize ); | 117 | preferences->changeColumnPreference ( 13, newsize ); |
111 | break; | 118 | break; |
112 | case 1: | 119 | case 1: |
113 | preferences->changeColumnPreference ( 14, newsize ); | 120 | preferences->changeColumnPreference ( 14, newsize ); |
114 | break; | 121 | break; |
115 | case 2: | 122 | case 2: |
116 | preferences->changeColumnPreference ( 15, newsize ); | 123 | preferences->changeColumnPreference ( 15, newsize ); |
117 | break; | 124 | break; |
118 | } | 125 | } |
119 | } | 126 | } |
120 | 127 | ||
128 | void BudgetDisplay::saveSortingPreference ( int column ) | ||
129 | { | ||
130 | preferences->changeSortingPreference ( 3, column ); | ||
131 | } | ||
132 | |||
121 | int BudgetDisplay::getIDColumn () | 133 | int BudgetDisplay::getIDColumn () |
122 | { | 134 | { |
123 | int counter; | 135 | int counter; |
124 | int columns = listview->columns(); | 136 | int columns = listview->columns(); |
125 | for ( counter = 0; counter <= columns; counter++ ) | 137 | for ( counter = 0; counter <= columns; counter++ ) |
126 | if ( listview->header()->label ( counter ).length() == 0 ) | 138 | if ( listview->header()->label ( counter ).length() == 0 ) |
127 | return counter; | 139 | return counter; |
128 | } | 140 | } |
129 | 141 | ||
130 | void BudgetDisplay::newBudget () | 142 | void BudgetDisplay::newBudget () |
131 | { | 143 | { |
132 | constructBudgetWindow(); | 144 | constructBudgetWindow(); |
diff --git a/noncore/apps/qashmoney/budgetdisplay.h b/noncore/apps/qashmoney/budgetdisplay.h index 25e952a..3976ce1 100755 --- a/noncore/apps/qashmoney/budgetdisplay.h +++ b/noncore/apps/qashmoney/budgetdisplay.h | |||
@@ -60,24 +60,25 @@ class BudgetDisplay : public QWidget | |||
60 | void newBudget (); | 60 | void newBudget (); |
61 | void deleteBudget (); | 61 | void deleteBudget (); |
62 | void setCurrentBudget ( int ); | 62 | void setCurrentBudget ( int ); |
63 | void setCurrentView ( int ); | 63 | void setCurrentView ( int ); |
64 | void showCalendar (); | 64 | void showCalendar (); |
65 | void newLineItem (); | 65 | void newLineItem (); |
66 | void deleteLineItem (); | 66 | void deleteLineItem (); |
67 | void checkBudgets (); | 67 | void checkBudgets (); |
68 | void editBudget (); | 68 | void editBudget (); |
69 | void editLineItem (); | 69 | void editLineItem (); |
70 | void constructBudgetWindow (); | 70 | void constructBudgetWindow (); |
71 | void constructLineItemWindow (); | 71 | void constructLineItemWindow (); |
72 | void saveSortingPreference ( int column ); | ||
72 | 73 | ||
73 | private: | 74 | private: |
74 | QStringList *names; | 75 | QStringList *names; |
75 | QStringList *ids; | 76 | QStringList *ids; |
76 | int currentbudget, year, month, day; | 77 | int currentbudget, year, month, day; |
77 | QDate newDate; | 78 | QDate newDate; |
78 | QString totalbudget, totalactual; | 79 | QString totalbudget, totalactual; |
79 | QString datelabel; | 80 | QString datelabel; |
80 | QDialog *nb; | 81 | QDialog *nb; |
81 | QDialog *newlineitem; | 82 | QDialog *newlineitem; |
82 | }; | 83 | }; |
83 | 84 | ||
diff --git a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control index b00e3b1..ec65c0e 100755 --- a/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control +++ b/noncore/apps/qashmoney/install/CONTROL/opie-qashmoney.control | |||
@@ -1,7 +1,8 @@ | |||
1 | Package: qashmoney | 1 | Package: qashmoney |
2 | Files: bin/qashmoney pics/qashmony/* pics/qashmony/flags/* apps/Applications/qashmoney.desktop | ||
2 | Priority: optional | 3 | Priority: optional |
3 | Version: 0.75 | 4 | Version: 0.76 |
4 | Architecture: arm | 5 | Architecture: arm |
5 | Maintainer: Allen Forsythe qashmoneyman@attbi.com | 6 | Maintainer: Allen Forsythe allen@qashmoney.org |
6 | Section: Applications | 7 | Section: Applications |
7 | Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. | 8 | Description: QashMoney provides an intuitive and fast way to keep track of your accounts and budgets. |
diff --git a/noncore/apps/qashmoney/preferences.cpp b/noncore/apps/qashmoney/preferences.cpp index 9bf64dd..880807a 100755 --- a/noncore/apps/qashmoney/preferences.cpp +++ b/noncore/apps/qashmoney/preferences.cpp | |||
@@ -141,36 +141,86 @@ void Preferences::initializeColumnPreferences () | |||
141 | 141 | ||
142 | // initialize budget budget column | 142 | // initialize budget budget column |
143 | sqlite_get_table ( db, "select width from columns where id = 14;", &results, &rows, &columns, 0 ); | 143 | sqlite_get_table ( db, "select width from columns where id = 14;", &results, &rows, &columns, 0 ); |
144 | if ( rows == 0 ) | 144 | if ( rows == 0 ) |
145 | sqlite_exec ( db, "insert into columns values ( 'budgetbudget', 50, 0, 0, 0, NULL );", 0, 0, 0 ); | 145 | sqlite_exec ( db, "insert into columns values ( 'budgetbudget', 50, 0, 0, 0, NULL );", 0, 0, 0 ); |
146 | 146 | ||
147 | // initialize budget actual column | 147 | // initialize budget actual column |
148 | sqlite_get_table ( db, "select width from columns where id = 15;", &results, &rows, &columns, 0 ); | 148 | sqlite_get_table ( db, "select width from columns where id = 15;", &results, &rows, &columns, 0 ); |
149 | if ( rows == 0 ) | 149 | if ( rows == 0 ) |
150 | sqlite_exec ( db, "insert into columns values ( 'budgetactual', 50, 0, 0, 0, NULL );", 0, 0, 0 ); | 150 | sqlite_exec ( db, "insert into columns values ( 'budgetactual', 50, 0, 0, 0, NULL );", 0, 0, 0 ); |
151 | } | 151 | } |
152 | 152 | ||
153 | void Preferences::initializeSortingPreferences () | ||
154 | { | ||
155 | int rows = 0; | ||
156 | int columns = 0; | ||
157 | char **results; | ||
158 | |||
159 | if ( sqlite_get_table ( db, "select count() from sorting;", 0, 0, 0, 0 ) != 0 ) | ||
160 | sqlite_exec ( db, "create table sorting ( listbox, column, direction, id integer primary key );", 0, 0, 0 ); | ||
161 | |||
162 | // initialize account listbox sorting. Set direction = 1 here so ascending sort is default. | ||
163 | sqlite_get_table ( db, "select column, direction from sorting where id = 1;", &results, &rows, &columns, 0 ); | ||
164 | if ( rows == 0 ) | ||
165 | sqlite_exec ( db, "insert into sorting values ( 'accounts', 0, 1, NULL );", 0, 0, 0 ); | ||
166 | |||
167 | // initialize transaction listbox sorting | ||
168 | sqlite_get_table ( db, "select column, direction from sorting where id = 2;", &results, &rows, &columns, 0); | ||
169 | if ( rows == 0 ) | ||
170 | sqlite_exec ( db, "insert into sorting values ( 'transactions', 0, 1, NULL );", 0, 0, 0 ); | ||
171 | |||
172 | // initialize budgets listbox sorting | ||
173 | sqlite_get_table ( db, "select column, direction from sorting where id = 3;", & results, &rows, &columns, 0 ); | ||
174 | if ( rows == 0 ) | ||
175 | sqlite_exec ( db, "insert into sorting values ( 'budgets', 0, 1, NULL );", 0, 0, 0 ); | ||
176 | } | ||
177 | |||
153 | void Preferences::changeColumnPreference ( int id, int width ) | 178 | void Preferences::changeColumnPreference ( int id, int width ) |
154 | { | 179 | { |
155 | sqlite_exec_printf ( db, "update columns set width = %i where id = %i;", 0, 0, 0, width, id ); | 180 | sqlite_exec_printf ( db, "update columns set width = %i where id = %i;", 0, 0, 0, width, id ); |
156 | } | 181 | } |
157 | 182 | ||
158 | int Preferences::getColumnPreference ( int id ) | 183 | int Preferences::getColumnPreference ( int id ) |
159 | { | 184 | { |
160 | char **results; | 185 | char **results; |
161 | sqlite_get_table_printf ( db, "select width from columns where id = %i;", &results, NULL, NULL, NULL, id ); | 186 | sqlite_get_table_printf ( db, "select width from columns where id = %i;", &results, NULL, NULL, NULL, id ); |
162 | return atoi ( results [ 1 ] ); | 187 | return atoi ( results [ 1 ] ); |
163 | } | 188 | } |
164 | 189 | ||
190 | void Preferences::changeSortingPreference ( int id, int column ) | ||
191 | { | ||
192 | int pColumn = 0; // column setting coming from the prefs object | ||
193 | int pDirection = 0; // direction setting coming from the prefs object | ||
194 | |||
195 | // because there appears to be no way to query the QT header object directly for it's current sort settings, we have | ||
196 | // to maintain track of them ourselves. So start by pulling the current saved setting for this view. | ||
197 | getSortingPreference ( id, &pColumn, &pDirection ); | ||
198 | |||
199 | // if the current saved column == the new column, then the user wants to toggle the sort order. | ||
200 | // otherwise we behave like QT does by default, which is to select the new column and default to an ascending sort. | ||
201 | if ( column == pColumn ) | ||
202 | sqlite_exec_printf ( db, "update sorting set direction = %i where id = %i;", 0, 0, 0, !pDirection, id ); | ||
203 | else | ||
204 | sqlite_exec_printf ( db, "update sorting set column = %i, direction = 1 where id = %i;", 0, 0, 0, column, id ); | ||
205 | } | ||
206 | |||
207 | void Preferences::getSortingPreference ( int id, int *column, int *direction ) | ||
208 | { | ||
209 | char **results; | ||
210 | sqlite_get_table_printf ( db, "select column, direction from sorting where id = %i;", &results, NULL, NULL, NULL, id ); | ||
211 | *column = atoi ( results [ 2 ] ); | ||
212 | *direction = atoi ( results [ 3 ] ); | ||
213 | } | ||
214 | |||
165 | int Preferences::getPreference ( int id ) | 215 | int Preferences::getPreference ( int id ) |
166 | { | 216 | { |
167 | char **results; | 217 | char **results; |
168 | sqlite_get_table_printf ( db, "select preference from preferences where id = %i;", &results, NULL, NULL, NULL, id ); | 218 | sqlite_get_table_printf ( db, "select preference from preferences where id = %i;", &results, NULL, NULL, NULL, id ); |
169 | return atoi ( results [ 1 ] ); | 219 | return atoi ( results [ 1 ] ); |
170 | } | 220 | } |
171 | 221 | ||
172 | QString Preferences::getSeparator ( ) | 222 | QString Preferences::getSeparator ( ) |
173 | { | 223 | { |
174 | int s = getPreference ( 2 ); | 224 | int s = getPreference ( 2 ); |
175 | if ( s == 1 ) | 225 | if ( s == 1 ) |
176 | return "/"; | 226 | return "/"; |
diff --git a/noncore/apps/qashmoney/preferences.h b/noncore/apps/qashmoney/preferences.h index 4a3e058..10ec6e9 100755 --- a/noncore/apps/qashmoney/preferences.h +++ b/noncore/apps/qashmoney/preferences.h | |||
@@ -3,36 +3,39 @@ | |||
3 | 3 | ||
4 | #ifndef PREFERENCES_H | 4 | #ifndef PREFERENCES_H |
5 | #define PREFERENCES_H | 5 | #define PREFERENCES_H |
6 | 6 | ||
7 | class Preferences | 7 | class Preferences |
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | Preferences (); | 10 | Preferences (); |
11 | ~Preferences (); | 11 | ~Preferences (); |
12 | 12 | ||
13 | void addPreferences (); | 13 | void addPreferences (); |
14 | void initializeColumnPreferences (); | 14 | void initializeColumnPreferences (); |
15 | void initializeSortingPreferences (); | ||
15 | 16 | ||
16 | // Returns a preference value for the given preferences ID | 17 | // Returns a preference value for the given preferences ID |
17 | int getPreference ( int ); | 18 | int getPreference ( int ); |
18 | int getColumnPreference ( int id ); | 19 | int getColumnPreference ( int id ); |
20 | void getSortingPreference ( int id, int *column, int *direction ); | ||
19 | 21 | ||
20 | // Convenience for getting date separator with one function | 22 | // Convenience for getting date separator with one function |
21 | // call. Takes the preference id as its argument | 23 | // call. Takes the preference id as its argument |
22 | QString getSeparator ( ); | 24 | QString getSeparator ( ); |
23 | 25 | ||
24 | // Changes a preference for the given ID | 26 | // Changes a preference for the given ID |
25 | void changePreference ( int , int ); | 27 | void changePreference ( int , int ); |
26 | void changeColumnPreference ( int id, int width ); | 28 | void changeColumnPreference ( int id, int width ); |
29 | void changeSortingPreference ( int id, int column ); | ||
27 | 30 | ||
28 | // The primary database that stores all our data | 31 | // The primary database that stores all our data |
29 | sqlite *db; | 32 | sqlite *db; |
30 | 33 | ||
31 | // This function returns a Qstring for the year first date formats | 34 | // This function returns a Qstring for the year first date formats |
32 | // for displaying. It takes the date numbers | 35 | // for displaying. It takes the date numbers |
33 | QString getDate ( int, int, int ); | 36 | QString getDate ( int, int, int ); |
34 | QString getDate ( int y, int m ); | 37 | QString getDate ( int y, int m ); |
35 | 38 | ||
36 | void setDefaultDatePreferences (); | 39 | void setDefaultDatePreferences (); |
37 | }; | 40 | }; |
38 | 41 | ||
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp index 83eea01..20e8d32 100755 --- a/noncore/apps/qashmoney/qashmoney.cpp +++ b/noncore/apps/qashmoney/qashmoney.cpp | |||
@@ -5,26 +5,27 @@ | |||
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <iostream.h> | 6 | #include <iostream.h> |
7 | 7 | ||
8 | Budget *budget = new Budget (); | 8 | Budget *budget = new Budget (); |
9 | Preferences *preferences = new Preferences (); | 9 | Preferences *preferences = new Preferences (); |
10 | Account *account = new Account (); | 10 | Account *account = new Account (); |
11 | Transaction *transaction = new Transaction (); | 11 | Transaction *transaction = new Transaction (); |
12 | Transfer *transfer = new Transfer (); | 12 | Transfer *transfer = new Transfer (); |
13 | Memory *memory = new Memory (); | 13 | Memory *memory = new Memory (); |
14 | 14 | ||
15 | QashMoney::QashMoney () : QWidget () | 15 | QashMoney::QashMoney () : QWidget () |
16 | { | 16 | { |
17 | preferences->addPreferences(); | 17 | preferences->addPreferences (); |
18 | preferences->initializeColumnPreferences (); | 18 | preferences->initializeColumnPreferences (); |
19 | preferences->initializeSortingPreferences (); | ||
19 | 20 | ||
20 | // set the text in the upper part of the frame | 21 | // set the text in the upper part of the frame |
21 | setCaption ( tr ( "QashMoney" ) ); | 22 | setCaption ( tr ( "QashMoney" ) ); |
22 | 23 | ||
23 | // Create new menubar for our mainwindow | 24 | // Create new menubar for our mainwindow |
24 | // and add menu items | 25 | // and add menu items |
25 | mainmenu = new QPEMenuBar ( this ); | 26 | mainmenu = new QPEMenuBar ( this ); |
26 | mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); | 27 | mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised ); |
27 | preferencesmenu = new QPopupMenu ( this ); | 28 | preferencesmenu = new QPopupMenu ( this ); |
28 | utilitiesmenu = new QPopupMenu ( this ); | 29 | utilitiesmenu = new QPopupMenu ( this ); |
29 | mainmenu->insertItem ( "Preferences", preferencesmenu ); | 30 | mainmenu->insertItem ( "Preferences", preferencesmenu ); |
30 | mainmenu->insertItem ( "Utilities", utilitiesmenu ); | 31 | mainmenu->insertItem ( "Utilities", utilitiesmenu ); |
@@ -144,68 +145,80 @@ void QashMoney::changeTabDisplay () | |||
144 | transactiondisplay->setAccountID ( accountid ); | 145 | transactiondisplay->setAccountID ( accountid ); |
145 | 146 | ||
146 | setTransactionDisplayDate (); | 147 | setTransactionDisplayDate (); |
147 | 148 | ||
148 | // display transactions | 149 | // display transactions |
149 | transactiondisplay->listview->clear(); | 150 | transactiondisplay->listview->clear(); |
150 | QString displaytext = "%"; | 151 | QString displaytext = "%"; |
151 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 152 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
152 | if ( transaction->getNumberOfTransactions() > 0 ) | 153 | if ( transaction->getNumberOfTransactions() > 0 ) |
153 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 154 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
154 | 155 | ||
155 | // display transfers | 156 | // display transfers |
156 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 157 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
157 | 158 | ||
158 | // open a new preferences object and resize the transaction display columns | 159 | // open a new preferences object and resize the transaction display columns |
159 | // each column will have a different size based on whether we are looking at a child | 160 | // each column will have a different size based on whether we are looking at a child |
160 | // account or children through a parent | 161 | // account or children through a parent |
161 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns | 162 | if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns |
162 | { | 163 | { |
163 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width | 164 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width |
164 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 165 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
165 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width | 166 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width |
166 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); | 167 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); |
167 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 5 ) ); // normal transaction amount width | 168 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 5 ) ); // normal transaction amount width |
168 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); | 169 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); |
169 | } | 170 | } |
170 | else | 171 | else |
171 | { | 172 | { |
172 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 6 ) ); // extended transaction date width | 173 | transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 6 ) ); // extended transaction date width |
173 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); | 174 | transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual ); |
174 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 7 ) ); // extended transaction name width | 175 | transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 7 ) ); // extended transaction name width |
175 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); | 176 | transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual ); |
176 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width | 177 | transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width |
177 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); | 178 | transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual ); |
178 | transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width | 179 | transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width |
179 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); | 180 | transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual ); |
180 | } | 181 | } |
182 | |||
183 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | ||
184 | int column = 0; | ||
185 | int direction = 0; | ||
186 | preferences->getSortingPreference ( 2, &column, &direction ); | ||
187 | transactiondisplay->listview->setSorting ( column, direction ); | ||
181 | 188 | ||
182 | // show the window | 189 | // show the window |
183 | transactiondisplay->show(); | 190 | transactiondisplay->show(); |
184 | // hide the account display and define accountid | 191 | // hide the account display and define accountid |
185 | accountdisplay->hide(); | 192 | accountdisplay->hide(); |
186 | // hide the budget display | 193 | // hide the budget display |
187 | budgetdisplay->hide(); | 194 | budgetdisplay->hide(); |
188 | } | 195 | } |
189 | else if ( maintabs->currentPageIndex() == 0 ) | 196 | else if ( maintabs->currentPageIndex() == 0 ) |
190 | { | 197 | { |
191 | disableOneTouchViewing(); | 198 | disableOneTouchViewing(); |
192 | 199 | ||
193 | // clear the account display selection | 200 | // clear the account display selection |
194 | accountdisplay->listview->clearSelection(); | 201 | accountdisplay->listview->clearSelection(); |
195 | 202 | ||
196 | // resize the account display columns | 203 | // resize the account display columns |
197 | accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) ); | 204 | accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) ); |
198 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); | 205 | accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) ); |
199 | 206 | ||
207 | // set sorting preference on account display columns | ||
208 | int column = 0; | ||
209 | int direction = 0; | ||
210 | preferences->getSortingPreference ( 1, &column, &direction ); | ||
211 | accountdisplay->listview->setSorting ( column, direction ); | ||
212 | |||
200 | // display the accounts | 213 | // display the accounts |
201 | if ( account->getNumberOfAccounts() != 0 ) | 214 | if ( account->getNumberOfAccounts() != 0 ) |
202 | account->displayAccounts ( accountdisplay->listview ); | 215 | account->displayAccounts ( accountdisplay->listview ); |
203 | maintabs->setTabEnabled ( tab_2, FALSE ); | 216 | maintabs->setTabEnabled ( tab_2, FALSE ); |
204 | 217 | ||
205 | // set the toggle button | 218 | // set the toggle button |
206 | accountdisplay->setToggleButton (); | 219 | accountdisplay->setToggleButton (); |
207 | 220 | ||
208 | // show the account display | 221 | // show the account display |
209 | accountdisplay->show(); | 222 | accountdisplay->show(); |
210 | 223 | ||
211 | // hide the transaction display | 224 | // hide the transaction display |
@@ -253,25 +266,25 @@ void QashMoney::displayDatePreferencesDialog () | |||
253 | 266 | ||
254 | // redisplay transactions if they are visible incorporating | 267 | // redisplay transactions if they are visible incorporating |
255 | // any changes to the date format | 268 | // any changes to the date format |
256 | transactiondisplay->listview->clear(); | 269 | transactiondisplay->listview->clear(); |
257 | QString displaytext = "%"; | 270 | QString displaytext = "%"; |
258 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 271 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
259 | 272 | ||
260 | setTransactionDisplayDate(); | 273 | setTransactionDisplayDate(); |
261 | if ( transaction->getNumberOfTransactions() > 0 ) | 274 | if ( transaction->getNumberOfTransactions() > 0 ) |
262 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 275 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
263 | 276 | ||
264 | if ( transfer->getNumberOfTransfers() != 0 ) | 277 | if ( transfer->getNumberOfTransfers() != 0 ) |
265 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 278 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
266 | } | 279 | } |
267 | else if ( accountdisplay->isVisible() ) | 280 | else if ( accountdisplay->isVisible() ) |
268 | { | 281 | { |
269 | accountdisplay->listview->clearSelection(); | 282 | accountdisplay->listview->clearSelection(); |
270 | maintabs->setTabEnabled ( tab_2, FALSE ); | 283 | maintabs->setTabEnabled ( tab_2, FALSE ); |
271 | } | 284 | } |
272 | else | 285 | else |
273 | budgetdisplay->updateBudgetInformation(); | 286 | budgetdisplay->updateBudgetInformation(); |
274 | } | 287 | } |
275 | 288 | ||
276 | void QashMoney::displayTransactionPreferencesDialog () | 289 | void QashMoney::displayTransactionPreferencesDialog () |
277 | { | 290 | { |
@@ -291,25 +304,25 @@ void QashMoney::displayTransactionPreferencesDialog () | |||
291 | children = FALSE; | 304 | children = FALSE; |
292 | 305 | ||
293 | // redisplay transactions incorporating any transaction preference changes | 306 | // redisplay transactions incorporating any transaction preference changes |
294 | transactiondisplay->listview->clear(); | 307 | transactiondisplay->listview->clear(); |
295 | QString displaytext = "%"; | 308 | QString displaytext = "%"; |
296 | displaytext.prepend ( transactiondisplay->limitbox->text() ); | 309 | displaytext.prepend ( transactiondisplay->limitbox->text() ); |
297 | 310 | ||
298 | setTransactionDisplayDate(); | 311 | setTransactionDisplayDate(); |
299 | if ( transaction->getNumberOfTransactions() > 0 ) | 312 | if ( transaction->getNumberOfTransactions() > 0 ) |
300 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); | 313 | transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate ); |
301 | 314 | ||
302 | if ( transfer->getNumberOfTransfers() != 0 ) | 315 | if ( transfer->getNumberOfTransfers() != 0 ) |
303 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children ); | 316 | transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate ); |
304 | } | 317 | } |
305 | else | 318 | else |
306 | { | 319 | { |
307 | accountdisplay->listview->clearSelection(); | 320 | accountdisplay->listview->clearSelection(); |
308 | maintabs->setTabEnabled ( tab_2, FALSE ); | 321 | maintabs->setTabEnabled ( tab_2, FALSE ); |
309 | } | 322 | } |
310 | } | 323 | } |
311 | 324 | ||
312 | void QashMoney::displayAccountPreferencesDialog () | 325 | void QashMoney::displayAccountPreferencesDialog () |
313 | { | 326 | { |
314 | // display a dialog for setting preferences for accounts | 327 | // display a dialog for setting preferences for accounts |
315 | AccountPreferences *ap = new AccountPreferences ( this ); | 328 | AccountPreferences *ap = new AccountPreferences ( this ); |
@@ -376,15 +389,15 @@ void QashMoney::setTransactionDisplayDate () | |||
376 | case 2: // three months | 389 | case 2: // three months |
377 | newdate = today.addDays ( -90 ); | 390 | newdate = today.addDays ( -90 ); |
378 | break; | 391 | break; |
379 | case 3: // six months | 392 | case 3: // six months |
380 | newdate = today.addDays ( -180 ); | 393 | newdate = today.addDays ( -180 ); |
381 | break; | 394 | break; |
382 | case 4: // one year | 395 | case 4: // one year |
383 | newdate = today.addDays ( -365 ); | 396 | newdate = today.addDays ( -365 ); |
384 | break; | 397 | break; |
385 | } | 398 | } |
386 | } | 399 | } |
387 | else | 400 | else |
388 | newdate = QDate ( 1, 1, 1000 ); | 401 | newdate = QDate ( 1900, 1, 1 ); |
389 | } | 402 | } |
390 | 403 | ||
diff --git a/noncore/apps/qashmoney/transaction.cpp b/noncore/apps/qashmoney/transaction.cpp index 5ecc7ed..a3bd9e7 100755 --- a/noncore/apps/qashmoney/transaction.cpp +++ b/noncore/apps/qashmoney/transaction.cpp | |||
@@ -146,79 +146,155 @@ int Transaction::getMonth ( int id ) | |||
146 | QString monthstring = results [ 1 ]; | 146 | QString monthstring = results [ 1 ]; |
147 | return monthstring.toInt(); | 147 | return monthstring.toInt(); |
148 | } | 148 | } |
149 | 149 | ||
150 | int Transaction::getYear ( int id ) | 150 | int Transaction::getYear ( int id ) |
151 | { | 151 | { |
152 | char **results; | 152 | char **results; |
153 | 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 ); |
154 | QString yearstring = results [ 1 ]; | 154 | QString yearstring = results [ 1 ]; |
155 | return yearstring.toInt(); | 155 | return yearstring.toInt(); |
156 | } | 156 | } |
157 | 157 | ||
158 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) | 158 | char ** Transaction::selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id ) |
159 | { | 159 | { |
160 | // initialize variables | ||
161 | char **results; | ||
160 | int showcleared = preferences->getPreference ( 3 ); | 162 | int showcleared = preferences->getPreference ( 3 ); |
161 | int year = ( displaydate.year() ) - 1; | 163 | QDate today = QDate::currentDate(); |
164 | int fromyear = fromdate.year(); | ||
165 | int toyear = today.year(); | ||
166 | int frommonth = fromdate.month(); | ||
167 | int tomonth = today.month(); | ||
168 | int fromday = fromdate.day(); | ||
162 | 169 | ||
163 | // select the transactions to display | 170 | // construct the first part of the string |
164 | // two different statements are used based on | 171 | QString query = "select day, month, year, payee, amount, transid, accountid from transactions where"; |
165 | // whether we are showing cleared transactions | 172 | |
166 | char **results; | 173 | if ( frommonth == tomonth && fromyear == toyear ) // our dates cross neither a month nor a year |
167 | int rows, columns; | ||
168 | if ( showcleared == 0 ) | ||
169 | { | 174 | { |
170 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 175 | query.append ( " year = " ); |
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 ); | 176 | query.append ( QString::number ( toyear ) ); |
172 | else | 177 | query.append ( " and month = " ); |
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 ); | 178 | query.append ( QString::number ( tomonth ) ); |
179 | query.append ( " and day >= " ); | ||
180 | query.append ( QString::number ( fromday ) ); | ||
181 | query.append ( " and" ); | ||
174 | } | 182 | } |
175 | else | 183 | else if ( frommonth != tomonth && fromyear == toyear ) // our dates cross a month within the same year |
176 | { | 184 | { |
177 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | 185 | query.append ( " year = " ); |
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 ); | 186 | query.append ( QString::number ( toyear ) ); |
179 | else | 187 | query.append ( " and ( ( month <= " ); |
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 ); | 188 | query.append ( QString::number ( tomonth ) ); |
189 | query.append ( " and month > " ); | ||
190 | query.append ( QString::number ( frommonth ) ); | ||
191 | query.append ( " ) or ( month = " ); | ||
192 | query.append ( QString::number ( frommonth ) ); | ||
193 | query.append ( " and day >= " ); | ||
194 | query.append ( QString::number ( fromday ) ); | ||
195 | query.append ( " ) ) and " ); | ||
181 | } | 196 | } |
197 | else if ( fromyear != toyear && fromyear != 1900 ) // here we are showing transactions from an entire year | ||
198 | { | ||
199 | // divide this taks into two parts - get the transactions from the prior and then the current year | ||
200 | // current year part | ||
201 | int tmpfrommonth = 1; // set temporary from months and days to Jan. 1 | ||
202 | int tmpfromday = 1; | ||
203 | query.append ( " ( year >= " ); | ||
204 | query.append ( QString::number ( fromyear ) ); | ||
205 | query.append ( " and ( month <= " ); | ||
206 | query.append ( QString::number ( tomonth ) ); | ||
207 | query.append ( " and month > " ); | ||
208 | query.append ( QString::number ( tmpfrommonth ) ); | ||
209 | query.append ( " ) or ( month = " ); | ||
210 | query.append ( QString::number ( tmpfrommonth ) ); | ||
211 | query.append ( " and day >= " ); | ||
212 | query.append ( QString::number ( tmpfromday ) ); | ||
213 | query.append ( " ) ) or" ); | ||
214 | |||
215 | // prior year part | ||
216 | int tmptomonth = 12; | ||
217 | query.append ( " ( year = " ); | ||
218 | query.append ( QString::number ( fromyear ) ); | ||
219 | query.append ( " and ( ( month <= " ); | ||
220 | query.append ( QString::number ( tmptomonth ) ); | ||
221 | query.append ( " and month > " ); | ||
222 | query.append ( QString::number ( frommonth ) ); | ||
223 | query.append ( " ) or ( month = " ); | ||
224 | query.append ( QString::number ( frommonth ) ); | ||
225 | query.append ( " and day >= " ); | ||
226 | query.append ( QString::number ( fromday ) ); | ||
227 | query.append ( " ) ) ) and " ); | ||
228 | } | ||
229 | |||
230 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | ||
231 | query.append ( " parentid = %i and payee like '%q';" ); | ||
232 | else | ||
233 | query.append ( " accountid = %i and payee like '%q';" ); | ||
234 | |||
235 | sqlite_get_table_printf ( tdb, query, &results, &rows, &columns, NULL, id, limit ); | ||
236 | return results; | ||
237 | } | ||
238 | |||
239 | char ** Transaction::selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id ) | ||
240 | { | ||
241 | char **results; | ||
242 | if ( account->getParentAccountID ( id ) == -1 && children == TRUE ) | ||
243 | 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 ); | ||
244 | else | ||
245 | 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 ); | ||
246 | return results; | ||
247 | } | ||
248 | |||
249 | void Transaction::displayTransactions ( QListView *listview, int id, bool children, const char *limit, QDate displaydate ) | ||
250 | { | ||
251 | int showcleared = preferences->getPreference ( 3 ); | ||
252 | |||
253 | char **results; | ||
254 | if ( showcleared == 0 ) | ||
255 | results = selectNonClearedTransactions ( displaydate, children, limit, id ); | ||
256 | else | ||
257 | results = selectAllTransactions ( displaydate, children, limit, id ); | ||
182 | 258 | ||
183 | // iterate through the result list and display each item | 259 | // iterate through the result list and display each item |
184 | int counter = 7; | 260 | int counter = 7; |
185 | while ( counter < ( ( rows + 1 ) * columns ) ) | 261 | while ( counter < ( ( rows + 1 ) * columns ) ) |
186 | { | 262 | { |
187 | QDate displaydate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); | 263 | //QDate testdate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
188 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); | 264 | QString date = preferences->getDate ( atoi ( results [ counter + 2 ] ), atoi ( results [ counter + 1 ] ), atoi ( results [ counter ] ) ); |
189 | 265 | ||
190 | // construct transaction name, amount, id | 266 | // construct transaction name, amount, id |
191 | QString payee = results [ counter + 3 ]; | 267 | QString payee = results [ counter + 3 ]; |
192 | QString amount = results [ counter + 4 ]; | 268 | QString amount = results [ counter + 4 ]; |
193 | QString transferid = results [ counter + 5 ]; | 269 | QString transferid = results [ counter + 5 ]; |
194 | 270 | ||
195 | //determine the account name of the child accounts that we're displaying | 271 | //determine the account name of the child accounts that we're displaying |
196 | QString accountname = account->getAccountName ( atoi ( results [ counter + 6 ] ) ); | 272 | QString accountname = account->getAccountName ( atoi ( results [ counter + 6 ] ) ); |
197 | 273 | ||
198 | // fill in values | 274 | // fill in values |
199 | if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account | 275 | if ( account->getParentAccountID ( id ) != -1 ) // use these constructors if we're showing a child account |
200 | { | 276 | { |
201 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) | 277 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) |
202 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid); | 278 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid ); |
203 | else | 279 | else |
204 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid ); | 280 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid ); |
205 | } | 281 | } |
206 | else | 282 | else |
207 | { | 283 | { |
208 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) | 284 | if ( showcleared == 1 && getCleared ( transferid.toInt() ) == 1 ) |
209 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid, accountname ); | 285 | ColorListItem *item = new ColorListItem ( listview, date, payee, amount, transferid, accountname ); |
210 | else | 286 | else |
211 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid, accountname ); | 287 | QListViewItem *item = new QListViewItem ( listview, date, payee, amount, transferid, accountname ); |
212 | } | 288 | } |
213 | 289 | ||
214 | // advance counter | 290 | // advance counter |
215 | counter = counter + 7; | 291 | counter = counter + 7; |
216 | } | 292 | } |
217 | } | 293 | } |
218 | 294 | ||
219 | QString Transaction::getBudgetTotal ( int budgetid, int lineitemid, int year, int month, int viewtype ) | 295 | QString Transaction::getBudgetTotal ( int budgetid, int lineitemid, int year, int month, int viewtype ) |
220 | { | 296 | { |
221 | // determine if we are viewing a years, months, or days budget | 297 | // determine if we are viewing a years, months, or days budget |
222 | // we have to pick a different sum for each | 298 | // we have to pick a different sum for each |
223 | char **results; | 299 | char **results; |
224 | switch ( viewtype ) | 300 | switch ( viewtype ) |
diff --git a/noncore/apps/qashmoney/transaction.h b/noncore/apps/qashmoney/transaction.h index 7297bb1..5871555 100755 --- a/noncore/apps/qashmoney/transaction.h +++ b/noncore/apps/qashmoney/transaction.h | |||
@@ -36,35 +36,38 @@ class Transaction | |||
36 | void deleteAllTransactions ( int accountid ); | 36 | void deleteAllTransactions ( int accountid ); |
37 | 37 | ||
38 | 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 ); |
39 | QString getActualTotal ( int budgetid, int year, int month, int viewtype ); | 39 | QString getActualTotal ( int budgetid, int year, int month, int viewtype ); |
40 | 40 | ||
41 | // 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 |
42 | void clearBudgetIDs ( int, int ); | 42 | void clearBudgetIDs ( int, int ); |
43 | void clearBudgetIDs ( int ); | 43 | void clearBudgetIDs ( int ); |
44 | 44 | ||
45 | public slots: | 45 | public slots: |
46 | 46 | ||
47 | void displayTransactions ( QListView *, int, bool, const char *, QDate ); | 47 | void displayTransactions ( QListView *, int, bool, const char *, QDate ); |
48 | char ** selectAllTransactions ( QDate fromdate, bool children, const char *limit, int id ); | ||
49 | char ** selectNonClearedTransactions ( QDate fromdate, bool children, const char *limit, int id ); | ||
48 | QString getPayee ( int ); | 50 | QString getPayee ( int ); |
49 | QString getTransactionDescription ( int ); | 51 | QString getTransactionDescription ( int ); |
50 | QString getNumber ( int ); | 52 | QString getNumber ( int ); |
51 | QString getAmount ( int ); | 53 | QString getAmount ( int ); |
52 | QString getAbsoluteAmount ( int ); | 54 | QString getAbsoluteAmount ( int ); |
53 | int getCleared ( int ); | 55 | int getCleared ( int ); |
54 | void setCleared ( int id, int cleared ); | 56 | void setCleared ( int id, int cleared ); |
55 | int getBudgetID ( int id ); | 57 | int getBudgetID ( int id ); |
56 | int getLineItemID ( int id ); | 58 | int getLineItemID ( int id ); |
57 | int getDay ( int ); | 59 | int getDay ( int ); |
58 | int getMonth ( int ); | 60 | int getMonth ( int ); |
59 | int getYear ( int ); | 61 | int getYear ( int ); |
60 | int getAccountID ( int id ); | 62 | int getAccountID ( int id ); |
61 | 63 | ||
62 | private: | 64 | private: |
63 | 65 | ||
64 | sqlite *tdb; | 66 | sqlite *tdb; |
67 | int rows, columns; | ||
65 | }; | 68 | }; |
66 | 69 | ||
67 | #endif | 70 | #endif |
68 | 71 | ||
69 | 72 | ||
70 | 73 | ||
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp index ae6223d..1839cd2 100755 --- a/noncore/apps/qashmoney/transactiondisplay.cpp +++ b/noncore/apps/qashmoney/transactiondisplay.cpp | |||
@@ -58,24 +58,25 @@ TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent ) | |||
58 | balance = new QLabel ( secondline ); | 58 | balance = new QLabel ( secondline ); |
59 | 59 | ||
60 | QLabel *limit = new QLabel ( "Limit", secondline ); | 60 | QLabel *limit = new QLabel ( "Limit", secondline ); |
61 | limitbox = new QLineEdit ( secondline ); | 61 | limitbox = new QLineEdit ( secondline ); |
62 | limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); | 62 | limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) ); |
63 | connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); | 63 | connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) ); |
64 | 64 | ||
65 | listview = new QListView ( this ); | 65 | listview = new QListView ( this ); |
66 | listview->setAllColumnsShowFocus ( TRUE ); | 66 | listview->setAllColumnsShowFocus ( TRUE ); |
67 | listview->setShowSortIndicator ( TRUE ); | 67 | listview->setShowSortIndicator ( TRUE ); |
68 | listview->header()->setTracking ( FALSE ); | 68 | listview->header()->setTracking ( FALSE ); |
69 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 69 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
70 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | ||
70 | 71 | ||
71 | layout = new QVBoxLayout ( this, 2, 2 ); | 72 | layout = new QVBoxLayout ( this, 2, 2 ); |
72 | layout->addWidget ( firstline ); | 73 | layout->addWidget ( firstline ); |
73 | layout->addWidget ( secondline ); | 74 | layout->addWidget ( secondline ); |
74 | layout->addWidget ( listview ); | 75 | layout->addWidget ( listview ); |
75 | } | 76 | } |
76 | 77 | ||
77 | void TransactionDisplay::addTransaction () | 78 | void TransactionDisplay::addTransaction () |
78 | { | 79 | { |
79 | // create local variables | 80 | // create local variables |
80 | int cleared = -1; | 81 | int cleared = -1; |
81 | 82 | ||
@@ -124,25 +125,25 @@ void TransactionDisplay::addTransaction () | |||
124 | newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); | 125 | newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() ); |
125 | 126 | ||
126 | // redisplay transactions | 127 | // redisplay transactions |
127 | listview->clear(); | 128 | listview->clear(); |
128 | QString displaytext = "%"; | 129 | QString displaytext = "%"; |
129 | displaytext.prepend ( limitbox->text() ); | 130 | displaytext.prepend ( limitbox->text() ); |
130 | setTransactionDisplayDate (); | 131 | setTransactionDisplayDate (); |
131 | if ( transaction->getNumberOfTransactions() > 0 ) | 132 | if ( transaction->getNumberOfTransactions() > 0 ) |
132 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 133 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
133 | 134 | ||
134 | // redisplay transfers | 135 | // redisplay transfers |
135 | if ( transfer->getNumberOfTransfers() > 0 ) | 136 | if ( transfer->getNumberOfTransfers() > 0 ) |
136 | transfer->displayTransfers ( listview, accountid, children ); | 137 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
137 | 138 | ||
138 | // add the transaction amount to the account it's associated with | 139 | // add the transaction amount to the account it's associated with |
139 | // and update its parent account balance if necessary | 140 | // and update its parent account balance if necessary |
140 | account->updateAccountBalance ( accountid ); | 141 | account->updateAccountBalance ( accountid ); |
141 | if ( account->getParentAccountID ( accountid ) != -1 ) | 142 | if ( account->getParentAccountID ( accountid ) != -1 ) |
142 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); | 143 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); |
143 | 144 | ||
144 | // format then reset the account balance | 145 | // format then reset the account balance |
145 | redisplayAccountBalance (); | 146 | redisplayAccountBalance (); |
146 | } | 147 | } |
147 | } | 148 | } |
148 | 149 | ||
@@ -363,25 +364,25 @@ void TransactionDisplay::editTransaction () | |||
363 | void TransactionDisplay::updateAndDisplay ( int id ) | 364 | void TransactionDisplay::updateAndDisplay ( int id ) |
364 | { | 365 | { |
365 | // redisplay transactions | 366 | // redisplay transactions |
366 | listview->clear(); | 367 | listview->clear(); |
367 | QString displaytext = "%"; | 368 | QString displaytext = "%"; |
368 | displaytext.prepend ( limitbox->text() ); | 369 | displaytext.prepend ( limitbox->text() ); |
369 | setTransactionDisplayDate (); | 370 | setTransactionDisplayDate (); |
370 | if ( transaction->getNumberOfTransactions() > 0 ) | 371 | if ( transaction->getNumberOfTransactions() > 0 ) |
371 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 372 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
372 | 373 | ||
373 | // redisplay transfers | 374 | // redisplay transfers |
374 | if ( transfer->getNumberOfTransfers() > 0 ) | 375 | if ( transfer->getNumberOfTransfers() > 0 ) |
375 | transfer->displayTransfers ( listview, accountid, children ); | 376 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
376 | 377 | ||
377 | // add the transaction amount to the account it's associated with | 378 | // add the transaction amount to the account it's associated with |
378 | // and update its parent account balance if necessary | 379 | // and update its parent account balance if necessary |
379 | account->updateAccountBalance ( id ); | 380 | account->updateAccountBalance ( id ); |
380 | if ( account->getParentAccountID ( id ) != -1 ) | 381 | if ( account->getParentAccountID ( id ) != -1 ) |
381 | account->changeParentAccountBalance ( account->getParentAccountID ( id ) ); | 382 | account->changeParentAccountBalance ( account->getParentAccountID ( id ) ); |
382 | 383 | ||
383 | // format then reset the account balance | 384 | // format then reset the account balance |
384 | redisplayAccountBalance (); | 385 | redisplayAccountBalance (); |
385 | } | 386 | } |
386 | 387 | ||
387 | void TransactionDisplay::checkListViewDelete () | 388 | void TransactionDisplay::checkListViewDelete () |
@@ -407,25 +408,25 @@ void TransactionDisplay::deleteTransaction () | |||
407 | childaccountid = transaction->getAccountID ( transactionid ); | 408 | childaccountid = transaction->getAccountID ( transactionid ); |
408 | 409 | ||
409 | transaction->deleteTransaction ( transactionid ); | 410 | transaction->deleteTransaction ( transactionid ); |
410 | 411 | ||
411 | listview->clear(); | 412 | listview->clear(); |
412 | QString displaytext = "%"; | 413 | QString displaytext = "%"; |
413 | displaytext.prepend ( limitbox->text() ); | 414 | displaytext.prepend ( limitbox->text() ); |
414 | setTransactionDisplayDate (); | 415 | setTransactionDisplayDate (); |
415 | if ( transaction->getNumberOfTransactions() > 0 ) | 416 | if ( transaction->getNumberOfTransactions() > 0 ) |
416 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 417 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
417 | 418 | ||
418 | if ( transfer->getNumberOfTransfers() > 0 ) | 419 | if ( transfer->getNumberOfTransfers() > 0 ) |
419 | transfer->displayTransfers ( listview, accountid, children ); | 420 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
420 | 421 | ||
421 | // if we are viewing different child accounts through the parent account | 422 | // if we are viewing different child accounts through the parent account |
422 | // ie if there are five columns and the parentid is -1 | 423 | // ie if there are five columns and the parentid is -1 |
423 | // update the accountid ( which is the parent ) and update the child account | 424 | // update the accountid ( which is the parent ) and update the child account |
424 | // balance. Get its accountid from the transactionid | 425 | // balance. Get its accountid from the transactionid |
425 | account->updateAccountBalance ( accountid ); // will update either a parent or child | 426 | account->updateAccountBalance ( accountid ); // will update either a parent or child |
426 | if ( account->getParentAccountID ( accountid ) != -1 ) // update its parent if there is one | 427 | if ( account->getParentAccountID ( accountid ) != -1 ) // update its parent if there is one |
427 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); | 428 | account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) ); |
428 | if ( childaccountid != -1 ) // we've set childaccountid | 429 | if ( childaccountid != -1 ) // we've set childaccountid |
429 | account->updateAccountBalance ( childaccountid ); | 430 | account->updateAccountBalance ( childaccountid ); |
430 | 431 | ||
431 | // format then reset the account balance | 432 | // format then reset the account balance |
@@ -439,25 +440,25 @@ void TransactionDisplay::deleteTransaction () | |||
439 | 440 | ||
440 | // delete the transfer and redisplay transactions | 441 | // delete the transfer and redisplay transactions |
441 | transfer->deleteTransfer ( transactionid ); | 442 | transfer->deleteTransfer ( transactionid ); |
442 | 443 | ||
443 | listview->clear(); | 444 | listview->clear(); |
444 | QString displaytext = "%"; | 445 | QString displaytext = "%"; |
445 | displaytext.prepend ( limitbox->text() ); | 446 | displaytext.prepend ( limitbox->text() ); |
446 | setTransactionDisplayDate (); | 447 | setTransactionDisplayDate (); |
447 | if ( transaction->getNumberOfTransactions() > 0 ) | 448 | if ( transaction->getNumberOfTransactions() > 0 ) |
448 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 449 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
449 | 450 | ||
450 | if ( transfer->getNumberOfTransfers() > 0 ) | 451 | if ( transfer->getNumberOfTransfers() > 0 ) |
451 | transfer->displayTransfers ( listview, accountid, children ); | 452 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
452 | 453 | ||
453 | // for the from account | 454 | // for the from account |
454 | account->updateAccountBalance ( fromaccountid ); | 455 | account->updateAccountBalance ( fromaccountid ); |
455 | if ( account->getParentAccountID ( fromaccountid ) != -1 ) | 456 | if ( account->getParentAccountID ( fromaccountid ) != -1 ) |
456 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccountid ) ); | 457 | account->changeParentAccountBalance ( account->getParentAccountID ( fromaccountid ) ); |
457 | 458 | ||
458 | // for the to account | 459 | // for the to account |
459 | account->updateAccountBalance ( toaccountid ); | 460 | account->updateAccountBalance ( toaccountid ); |
460 | if ( account->getParentAccountID ( toaccountid ) != -1 ) | 461 | if ( account->getParentAccountID ( toaccountid ) != -1 ) |
461 | account->changeParentAccountBalance ( account->getParentAccountID ( toaccountid ) ); | 462 | account->changeParentAccountBalance ( account->getParentAccountID ( toaccountid ) ); |
462 | 463 | ||
463 | // format then reset the account balance | 464 | // format then reset the account balance |
@@ -492,25 +493,25 @@ void TransactionDisplay::toggleTransaction () | |||
492 | else | 493 | else |
493 | transfer->setCleared ( transactionid, 0 ); | 494 | transfer->setCleared ( transactionid, 0 ); |
494 | } | 495 | } |
495 | 496 | ||
496 | listview->clear(); | 497 | listview->clear(); |
497 | QString displaytext = "%"; | 498 | QString displaytext = "%"; |
498 | displaytext.prepend ( limitbox->text() ); | 499 | displaytext.prepend ( limitbox->text() ); |
499 | setTransactionDisplayDate (); | 500 | setTransactionDisplayDate (); |
500 | if ( transaction->getNumberOfTransactions() > 0 ) | 501 | if ( transaction->getNumberOfTransactions() > 0 ) |
501 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 502 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
502 | 503 | ||
503 | if ( transfer->getNumberOfTransfers() != 0 ) | 504 | if ( transfer->getNumberOfTransfers() != 0 ) |
504 | transfer->displayTransfers ( listview, accountid, children ); | 505 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
505 | } | 506 | } |
506 | 507 | ||
507 | void TransactionDisplay::redisplayAccountBalance () | 508 | void TransactionDisplay::redisplayAccountBalance () |
508 | { | 509 | { |
509 | QString accountbalance = account->getAccountBalance ( accountid ); | 510 | QString accountbalance = account->getAccountBalance ( accountid ); |
510 | balance->setText ( accountbalance ); | 511 | balance->setText ( accountbalance ); |
511 | } | 512 | } |
512 | 513 | ||
513 | void TransactionDisplay::setChildren ( bool c ) | 514 | void TransactionDisplay::setChildren ( bool c ) |
514 | { | 515 | { |
515 | children = c; | 516 | children = c; |
516 | } | 517 | } |
@@ -542,35 +543,40 @@ void ColorListItem::paintCell ( QPainter *p, const QColorGroup &cg, int column, | |||
542 | } | 543 | } |
543 | 544 | ||
544 | void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | 545 | void TransactionDisplay::saveColumnSize ( int column, int oldsize, int newsize ) |
545 | { | 546 | { |
546 | if ( listview->columns() == 4 ) | 547 | if ( listview->columns() == 4 ) |
547 | preferences->changeColumnPreference ( column + 3, newsize ); | 548 | preferences->changeColumnPreference ( column + 3, newsize ); |
548 | else if ( listview->columns() == 5 && column != 4 ) | 549 | else if ( listview->columns() == 5 && column != 4 ) |
549 | preferences->changeColumnPreference ( column + 6, newsize ); | 550 | preferences->changeColumnPreference ( column + 6, newsize ); |
550 | else | 551 | else |
551 | preferences->changeColumnPreference ( 9, newsize ); | 552 | preferences->changeColumnPreference ( 9, newsize ); |
552 | } | 553 | } |
553 | 554 | ||
555 | void TransactionDisplay::saveSortingPreference ( int column ) | ||
556 | { | ||
557 | preferences->changeSortingPreference ( 2, column ); | ||
558 | } | ||
559 | |||
554 | void TransactionDisplay::limitDisplay ( const QString &text ) | 560 | void TransactionDisplay::limitDisplay ( const QString &text ) |
555 | { | 561 | { |
556 | listview->clear (); | 562 | listview->clear (); |
557 | QString displaytext = "%"; | 563 | QString displaytext = "%"; |
558 | displaytext.prepend ( text ); | 564 | displaytext.prepend ( text ); |
559 | setTransactionDisplayDate (); | 565 | setTransactionDisplayDate (); |
560 | if ( transaction->getNumberOfTransactions() > 0 ) | 566 | if ( transaction->getNumberOfTransactions() > 0 ) |
561 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); | 567 | transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate ); |
562 | 568 | ||
563 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) | 569 | if ( displaytext.length() == 1 || preferences->getPreference ( 6 ) == 1 ) |
564 | transfer->displayTransfers ( listview, accountid, children ); | 570 | transfer->displayTransfers ( listview, accountid, children, displaydate ); |
565 | } | 571 | } |
566 | 572 | ||
567 | int TransactionDisplay::getIDColumn () | 573 | int TransactionDisplay::getIDColumn () |
568 | { | 574 | { |
569 | int counter; | 575 | int counter; |
570 | int columns = listview->columns(); | 576 | int columns = listview->columns(); |
571 | for ( counter = 0; counter <= columns; counter++ ) | 577 | for ( counter = 0; counter <= columns; counter++ ) |
572 | if ( listview->header()->label ( counter ).length() == 0 ) | 578 | if ( listview->header()->label ( counter ).length() == 0 ) |
573 | return counter; | 579 | return counter; |
574 | } | 580 | } |
575 | 581 | ||
576 | void TransactionDisplay::showTransactionNotes () | 582 | void TransactionDisplay::showTransactionNotes () |
@@ -610,14 +616,14 @@ void TransactionDisplay::setTransactionDisplayDate () | |||
610 | case 2: // three months | 616 | case 2: // three months |
611 | displaydate = today.addDays ( -90 ); | 617 | displaydate = today.addDays ( -90 ); |
612 | break; | 618 | break; |
613 | case 3: // six months | 619 | case 3: // six months |
614 | displaydate = today.addDays ( -180 ); | 620 | displaydate = today.addDays ( -180 ); |
615 | break; | 621 | break; |
616 | case 4: // one year | 622 | case 4: // one year |
617 | displaydate = today.addDays ( -365 ); | 623 | displaydate = today.addDays ( -365 ); |
618 | break; | 624 | break; |
619 | } | 625 | } |
620 | } | 626 | } |
621 | else | 627 | else |
622 | displaydate = QDate ( 1, 1, 1000 ); | 628 | displaydate = QDate ( 1900, 1, 1 ); |
623 | } | 629 | } |
diff --git a/noncore/apps/qashmoney/transactiondisplay.h b/noncore/apps/qashmoney/transactiondisplay.h index 1746f6c..594776a 100755 --- a/noncore/apps/qashmoney/transactiondisplay.h +++ b/noncore/apps/qashmoney/transactiondisplay.h | |||
@@ -41,24 +41,25 @@ class TransactionDisplay : public QWidget | |||
41 | void editTransaction (); | 41 | void editTransaction (); |
42 | void editTransfer (); | 42 | void editTransfer (); |
43 | void deleteTransaction (); | 43 | void deleteTransaction (); |
44 | void toggleTransaction (); | 44 | void toggleTransaction (); |
45 | void checkListViewDelete (); | 45 | void checkListViewDelete (); |
46 | void checkListViewEdit (); | 46 | void checkListViewEdit (); |
47 | void checkListViewToggle (); | 47 | void checkListViewToggle (); |
48 | void saveColumnSize ( int column, int oldsize, int newsize ); | 48 | void saveColumnSize ( int column, int oldsize, int newsize ); |
49 | void limitDisplay ( const QString & ); | 49 | void limitDisplay ( const QString & ); |
50 | void showCalculator (); | 50 | void showCalculator (); |
51 | void showCalendar (); | 51 | void showCalendar (); |
52 | void setTransactionDisplayDate (); | 52 | void setTransactionDisplayDate (); |
53 | void saveSortingPreference ( int column ); | ||
53 | 54 | ||
54 | private: | 55 | private: |
55 | int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; | 56 | int accountid, fromaccount, fromparent, toaccount, toparent, day, month, year, transferid; |
56 | QDate displaydate; | 57 | QDate displaydate; |
57 | bool children; | 58 | bool children; |
58 | QBoxLayout *layout; | 59 | QBoxLayout *layout; |
59 | QHBox *firstline; | 60 | QHBox *firstline; |
60 | QHBox *secondline; | 61 | QHBox *secondline; |
61 | void redisplayAccountBalance (); | 62 | void redisplayAccountBalance (); |
62 | void updateAndDisplay ( int accountid ); | 63 | void updateAndDisplay ( int accountid ); |
63 | }; | 64 | }; |
64 | 65 | ||
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 () | |||
56 | } | 56 | } |
57 | 57 | ||
58 | int Transfer::getNumberOfTransfers ( int accountid ) | 58 | int Transfer::getNumberOfTransfers ( int accountid ) |
59 | { | 59 | { |
60 | char **results; | 60 | char **results; |
61 | sqlite_get_table_printf ( db, "select count() from transfers where fromaccount = %i;", &results, 0, 0, 0, accountid ); | 61 | sqlite_get_table_printf ( db, "select count() from transfers where fromaccount = %i;", &results, 0, 0, 0, accountid ); |
62 | int transfers = atoi ( results [ 1 ] ); | 62 | int transfers = atoi ( results [ 1 ] ); |
63 | sqlite_get_table_printf ( db, "select count() from transfers where toaccount = %i;", &results, 0, 0, 0, accountid ); | 63 | sqlite_get_table_printf ( db, "select count() from transfers where toaccount = %i;", &results, 0, 0, 0, accountid ); |
64 | transfers = transfers + atoi ( results [ 1 ] ); | 64 | transfers = transfers + atoi ( results [ 1 ] ); |
65 | return transfers; | 65 | return transfers; |
66 | } | 66 | } |
67 | 67 | ||
68 | void Transfer::displayTransfers ( QListView *listview, int accountid, bool children ) | 68 | void Transfer::displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ) |
69 | { | 69 | { |
70 | int showcleared = preferences->getPreference ( 3 ); | 70 | int showcleared = preferences->getPreference ( 3 ); |
71 | 71 | ||
72 | // select the from transfers to display | 72 | // select the from transfers to display |
73 | char **results; | 73 | char **results; |
74 | int rows, columns; | 74 | int rows, columns; |
75 | if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE ) | 75 | if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE ) |
76 | { | 76 | { |
77 | if ( showcleared == 0 ) | 77 | if ( showcleared == 0 ) |
78 | 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 ); | 78 | 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 ); |
79 | else | 79 | else |
80 | sqlite_get_table_printf ( db, "select day, month, year, amount, transferid, fromaccount, toaccount from transfers where toparent = %i;", &results, &rows, &columns, 0, accountid ); | 80 | 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 | |||
91 | int counter = 7; | 91 | int counter = 7; |
92 | int position = 0; | 92 | int position = 0; |
93 | while ( counter < ( ( rows + 1 ) * columns ) ) | 93 | while ( counter < ( ( rows + 1 ) * columns ) ) |
94 | { | 94 | { |
95 | // construct the date | 95 | // construct the date |
96 | QString daystring = results [ counter ]; | 96 | QString daystring = results [ counter ]; |
97 | int day = daystring.toInt (); | 97 | int day = daystring.toInt (); |
98 | QString monthstring = results [ counter + 1 ]; | 98 | QString monthstring = results [ counter + 1 ]; |
99 | int month = monthstring.toInt (); | 99 | int month = monthstring.toInt (); |
100 | QString yearstring = results [ counter + 2 ]; | 100 | QString yearstring = results [ counter + 2 ]; |
101 | int year = yearstring.toInt (); | 101 | int year = yearstring.toInt (); |
102 | QString date = preferences->getDate ( year, month, day ); | 102 | QString date = preferences->getDate ( year, month, day ); |
103 | QDate testdate ( year, month, day ); | ||
103 | 104 | ||
104 | //construct the amount and id strings | 105 | //construct the amount and id strings |
105 | QString amount = results [ counter + 3 ]; | 106 | QString amount = results [ counter + 3 ]; |
106 | QString id = results [ counter + 4 ]; | 107 | QString id = results [ counter + 4 ]; |
107 | 108 | ||
108 | // construct the transaction name | 109 | // construct the transaction name |
109 | QString transactionname = "FROM: "; | 110 | QString transactionname = "FROM: "; |
110 | QString temp1 = results [ counter + 5 ]; | 111 | QString temp1 = results [ counter + 5 ]; |
111 | transactionname.append ( account->getAccountName ( temp1.toInt() ) ); | 112 | transactionname.append ( account->getAccountName ( temp1.toInt() ) ); |
112 | 113 | ||
113 | QString toaccount = account->getAccountName ( atol ( results [ counter + 6 ] ) ); | 114 | QString toaccount = account->getAccountName ( atol ( results [ counter + 6 ] ) ); |
114 | 115 | ||
115 | // display this transfer | 116 | if ( testdate >= displaydate || showcleared == 0 ) |
116 | if ( account->getParentAccountID ( accountid ) == -1 ) | ||
117 | { | 117 | { |
118 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | 118 | // display this transfer |
119 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount ); | 119 | if ( account->getParentAccountID ( accountid ) == -1 ) |
120 | { | ||
121 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
122 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, toaccount ); | ||
123 | else | ||
124 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount ); | ||
125 | } | ||
120 | else | 126 | else |
121 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, toaccount ); | 127 | { |
128 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
129 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
130 | else | ||
131 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | ||
132 | } | ||
122 | } | 133 | } |
123 | else | ||
124 | { | ||
125 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
126 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
127 | else | ||
128 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | ||
129 | } | ||
130 | |||
131 | counter = counter + 7; | 134 | counter = counter + 7; |
132 | } | 135 | } |
133 | 136 | ||
134 | // select the to transfers to display | 137 | // select the to transfers to display |
135 | char **toresults; | 138 | char **toresults; |
136 | rows = 0; | 139 | rows = 0; |
137 | columns = 0; | 140 | columns = 0; |
138 | if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE ) | 141 | if ( account->getParentAccountID ( accountid ) == -1 && children == TRUE ) |
139 | { | 142 | { |
140 | if ( showcleared == 0 ) | 143 | if ( showcleared == 0 ) |
141 | 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 ); | 144 | 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 ); |
142 | else | 145 | else |
@@ -154,51 +157,55 @@ void Transfer::displayTransfers ( QListView *listview, int accountid, bool child | |||
154 | counter = 7; | 157 | counter = 7; |
155 | position = 0; | 158 | position = 0; |
156 | while ( counter < ( ( rows + 1 ) * columns ) ) | 159 | while ( counter < ( ( rows + 1 ) * columns ) ) |
157 | { | 160 | { |
158 | // construct the date | 161 | // construct the date |
159 | QString daystring = toresults [ counter ]; | 162 | QString daystring = toresults [ counter ]; |
160 | int day = daystring.toInt (); | 163 | int day = daystring.toInt (); |
161 | QString monthstring = toresults [ counter + 1 ]; | 164 | QString monthstring = toresults [ counter + 1 ]; |
162 | int month = monthstring.toInt (); | 165 | int month = monthstring.toInt (); |
163 | QString yearstring = toresults [ counter + 2 ]; | 166 | QString yearstring = toresults [ counter + 2 ]; |
164 | int year = yearstring.toInt (); | 167 | int year = yearstring.toInt (); |
165 | QString date = preferences->getDate ( year, month, day ); | 168 | QString date = preferences->getDate ( year, month, day ); |
169 | QDate testdate ( year, month, day ); | ||
166 | 170 | ||
167 | //construct the amount and id strings | 171 | //construct the amount and id strings |
168 | QString amount = toresults [ counter + 3 ]; | 172 | QString amount = toresults [ counter + 3 ]; |
169 | amount.prepend ( "-" ); | 173 | amount.prepend ( "-" ); |
170 | QString id = toresults [ counter + 4 ]; | 174 | QString id = toresults [ counter + 4 ]; |
171 | 175 | ||
172 | // construct the transaction name | 176 | // construct the transaction name |
173 | QString transactionname = "TO: "; | 177 | QString transactionname = "TO: "; |
174 | QString temp1 = toresults [ counter + 6 ]; | 178 | QString temp1 = toresults [ counter + 6 ]; |
175 | transactionname.append ( account->getAccountName ( temp1.toInt() ) ); | 179 | transactionname.append ( account->getAccountName ( temp1.toInt() ) ); |
176 | 180 | ||
177 | QString fromaccount = account->getAccountName ( atol ( toresults [ counter + 5 ] ) ); | 181 | QString fromaccount = account->getAccountName ( atol ( toresults [ counter + 5 ] ) ); |
178 | 182 | ||
179 | // display this transfer | 183 | if ( testdate >= displaydate || showcleared == 0 ) |
180 | if ( account->getParentAccountID ( accountid ) == -1 ) | 184 | { |
181 | { | 185 | // display this transfer |
182 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | 186 | if ( account->getParentAccountID ( accountid ) == -1 ) |
183 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount ); | 187 | { |
184 | else | 188 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) |
185 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount ); | 189 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id, fromaccount ); |
186 | } | 190 | else |
187 | else | 191 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id, fromaccount ); |
188 | { | 192 | } |
189 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
190 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
191 | else | 193 | else |
192 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | 194 | { |
195 | if ( showcleared == 1 && getCleared ( id.toInt() ) == 1 ) | ||
196 | ColorListItem *item = new ColorListItem ( listview, date, transactionname, amount, id ); | ||
197 | else | ||
198 | QListViewItem *item = new QListViewItem ( listview, date, transactionname, amount, id ); | ||
199 | } | ||
193 | } | 200 | } |
194 | 201 | ||
195 | counter = counter + 7; | 202 | counter = counter + 7; |
196 | } | 203 | } |
197 | } | 204 | } |
198 | 205 | ||
199 | int Transfer::getCleared ( int id ) | 206 | int Transfer::getCleared ( int id ) |
200 | { | 207 | { |
201 | char **results; | 208 | char **results; |
202 | sqlite_get_table_printf ( db, "select cleared from transfers where transferid= %i;", &results, 0, 0, 0, id ); | 209 | sqlite_get_table_printf ( db, "select cleared from transfers where transferid= %i;", &results, 0, 0, 0, id ); |
203 | return atoi ( results [ 1 ] ); | 210 | return atoi ( results [ 1 ] ); |
204 | } | 211 | } |
diff --git a/noncore/apps/qashmoney/transfer.h b/noncore/apps/qashmoney/transfer.h index 33dedf4..e910e7c 100755 --- a/noncore/apps/qashmoney/transfer.h +++ b/noncore/apps/qashmoney/transfer.h | |||
@@ -1,18 +1,19 @@ | |||
1 | #ifndef TRANSFER_H | 1 | #ifndef TRANSFER_H |
2 | #define TRANSFER_H | 2 | #define TRANSFER_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <sqlite.h> | 6 | #include <sqlite.h> |
7 | #include <qdatetime.h> | ||
7 | 8 | ||
8 | #include "preferences.h" | 9 | #include "preferences.h" |
9 | 10 | ||
10 | class Transfer | 11 | class Transfer |
11 | { | 12 | { |
12 | public: | 13 | public: |
13 | 14 | ||
14 | Transfer (); | 15 | Transfer (); |
15 | ~Transfer (); | 16 | ~Transfer (); |
16 | 17 | ||
17 | // This function adds a new transfer to the database. It takes the fromaccount, toaccount, | 18 | // This function adds a new transfer to the database. It takes the fromaccount, toaccount, |
18 | // number, frombudget, tobudget, day, month, year, amount, cleared | 19 | // number, frombudget, tobudget, day, month, year, amount, cleared |
@@ -20,25 +21,25 @@ class Transfer | |||
20 | void updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid ); | 21 | void updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid ); |
21 | 22 | ||
22 | // Deletes a transfer. Takes the transferid as its parameter | 23 | // Deletes a transfer. Takes the transferid as its parameter |
23 | void deleteTransfer ( int ); | 24 | void deleteTransfer ( int ); |
24 | 25 | ||
25 | // Deletes all transfers for a given accountid | 26 | // Deletes all transfers for a given accountid |
26 | void deleteAllTransfers ( int accountid ); | 27 | void deleteAllTransfers ( int accountid ); |
27 | 28 | ||
28 | // Returns the number of checking transfers | 29 | // Returns the number of checking transfers |
29 | int getNumberOfTransfers (); | 30 | int getNumberOfTransfers (); |
30 | int getNumberOfTransfers ( int accountid ); | 31 | int getNumberOfTransfers ( int accountid ); |
31 | 32 | ||
32 | void displayTransfers ( QListView *listview, int accountid, bool children ); | 33 | void displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ); |
33 | int getCleared ( int id ); | 34 | int getCleared ( int id ); |
34 | void setCleared ( int id, int cleared ); | 35 | void setCleared ( int id, int cleared ); |
35 | int getFromAccountID ( int id ); | 36 | int getFromAccountID ( int id ); |
36 | int getToAccountID ( int id ); | 37 | int getToAccountID ( int id ); |
37 | 38 | ||
38 | int getDay ( int id ); | 39 | int getDay ( int id ); |
39 | int getMonth ( int id ); | 40 | int getMonth ( int id ); |
40 | int getYear ( int id ); | 41 | int getYear ( int id ); |
41 | QString getAmount ( int id ); | 42 | QString getAmount ( int id ); |
42 | 43 | ||
43 | private: | 44 | private: |
44 | 45 | ||
diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp index 7bc3eb0..f85c740 100755 --- a/noncore/apps/qashmoney/transferdialog.cpp +++ b/noncore/apps/qashmoney/transferdialog.cpp | |||
@@ -88,25 +88,25 @@ void TransferDialog::showCalendar () | |||
88 | int TransferDialog::getDay () | 88 | int TransferDialog::getDay () |
89 | { | 89 | { |
90 | return day; | 90 | return day; |
91 | } | 91 | } |
92 | 92 | ||
93 | int TransferDialog::getMonth () | 93 | int TransferDialog::getMonth () |
94 | { | 94 | { |
95 | return month; | 95 | return month; |
96 | } | 96 | } |
97 | 97 | ||
98 | int TransferDialog::getYear () | 98 | int TransferDialog::getYear () |
99 | { | 99 | { |
100 | return day; | 100 | return year; |
101 | } | 101 | } |
102 | 102 | ||
103 | void TransferDialog::showCalculator () | 103 | void TransferDialog::showCalculator () |
104 | { | 104 | { |
105 | Calculator *calculator = new Calculator ( this ); | 105 | Calculator *calculator = new Calculator ( this ); |
106 | if ( calculator->exec () == QDialog::Accepted ) | 106 | if ( calculator->exec () == QDialog::Accepted ) |
107 | amount->setText ( calculator->display->text() ); | 107 | amount->setText ( calculator->display->text() ); |
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||