From 5da154cd489837f6cdc83241747b91c0e6c73dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Wed, 18 Aug 2010 21:28:40 +0200 Subject: [PATCH] Add statistics Update README Update TODO --- README | 2 +- README.fr | 2 +- TODO | 2 +- ressources/po/french.mo | Bin 5897 -> 6038 bytes ressources/po/french.po | 102 +++++++++++++---------- ressources/po/kisscount.pot | 99 +++++++++++++---------- src/model/Database.cpp | 3 +- src/view/StatsPanel.cpp | 156 ++++++++++++++++++++++++++++-------- src/view/StatsPanel.h | 9 ++- 9 files changed, 251 insertions(+), 124 deletions(-) diff --git a/README b/README index b29ac33..3dd1684 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ KissCount is personnal account software delivered under GPL v3 licence terms. Current version is 0.1 beta (trunk version) -wxWidgets 2.8 is needed +wxWidgets 2.8 and sqlite3 is needed A modified version of wxFreeChart is used : warning during recompilation, don't overwrite autotools files with ./configure diff --git a/README.fr b/README.fr index d1f0228..75561b2 100644 --- a/README.fr +++ b/README.fr @@ -2,7 +2,7 @@ KissCount est un logiciel de gestion de comptes personnels délivré sous licenc La version actuelle est 0.1 bêta (version du tronc) -wxWidgets 2.8 est nécessaire +wxWidgets 2.8 et sqlite3 sont nécessaire Une version modifiée de wxFreeChart est utilisée : attention à lors de la recompilation à ne pas écraser les fichiers des autotools (pas de ./configure) diff --git a/TODO b/TODO index 69ed994..e039cf4 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ Version 0.1 -Statistics +Statistics (need to update libraries and add months/years label on graph) Copy and paste Import/Export module Using tabulation to navigate throw interface (Search Panel) diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 865c68f161b48c91d4c09051c2325cb250c66353..a73d1e30514c54be773846e78157df57516d1783 100644 GIT binary patch delta 2597 zcmYk+e@xVM9LMnwcZVh*ct?Ve#F-ve76L{IsE}zWl7xvMhIYk87@%BOD_1v~bJN<| zx@mLHjJ8}`OlXYN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?v>1{L}lgT lii-Z@<4>k{H%#mty*ts|)ZWtl%fy=gb(0RKbq^Js_#Y)S$aMe! diff --git a/ressources/po/french.po b/ressources/po/french.po index a60b137..0e074f8 100644 --- a/ressources/po/french.po +++ b/ressources/po/french.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-08-14 22:00+0200\n" +"POT-Creation-Date: 2010-08-18 20:59+0200\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -19,6 +19,7 @@ msgstr "" # FIRST AUTHOR , YEAR. # #: src/view/PreferencesPanel.cpp:574 +#: src/view/StatsPanel.cpp:288 msgid " - " msgstr " - " @@ -39,7 +40,7 @@ msgstr " entrées trouvées" msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:936 +#: src/view/AccountPanel.cpp:924 msgid " operations ?" msgstr " opérations ?" @@ -51,7 +52,7 @@ msgstr " profil ?" msgid "1 entry found" msgstr "1 entrée trouvée" -#: src/view/ButtonPanel.cpp:51 +#: src/view/ButtonPanel.cpp:52 msgid "About" msgstr "A propos" @@ -65,15 +66,16 @@ msgstr "Compte" msgid "Account " msgstr "Le compte " -#: src/view/AccountPanel.cpp:113 +#: src/view/AccountPanel.cpp:101 msgid "Account name" msgstr "Nom du compte" -#: src/view/AccountPanel.cpp:112 +#: src/view/AccountPanel.cpp:100 msgid "Account number" msgstr "Numéro de compte" #: src/view/PreferencesPanel.cpp:55 +#: src/view/StatsPanel.cpp:256 msgid "Accounts" msgstr "Comptes" @@ -87,12 +89,12 @@ msgstr "Montant max" #: src/view/PreferencesPanel.cpp:340 #: src/view/PreferencesPanel.cpp:581 -#: src/view/AccountPanel.cpp:931 +#: src/view/AccountPanel.cpp:919 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " #: src/view/PreferencesPanel.cpp:449 -#: src/view/AccountPanel.cpp:633 +#: src/view/AccountPanel.cpp:621 #: src/view/SearchPanel.cpp:345 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" @@ -133,7 +135,7 @@ msgstr "Changer le mot de passe" msgid "Change password" msgstr "Changer le mot de passe" -#: src/view/ButtonPanel.cpp:50 +#: src/view/ButtonPanel.cpp:51 msgid "Change user" msgstr "Changer d'utilisateur" @@ -145,7 +147,8 @@ msgstr "Couleur" msgid "Confirm password " msgstr "Confirmer le mot de passe" -#: src/view/AccountPanel.cpp:123 +#: src/view/StatsPanel.cpp:130 +#: src/view/AccountPanel.cpp:111 msgid "Cost repartition" msgstr "Répartition des coûts" @@ -153,15 +156,15 @@ msgstr "Répartition des coûts" msgid "Credit" msgstr "Crédit" -#: src/view/AccountPanel.cpp:193 +#: src/view/AccountPanel.cpp:181 msgid "Cur Credit" msgstr "Cur Crédit" -#: src/view/AccountPanel.cpp:194 +#: src/view/AccountPanel.cpp:182 msgid "Cur Debit" msgstr "Cur Débit" -#: src/view/AccountPanel.cpp:115 +#: src/view/AccountPanel.cpp:103 msgid "Current value" msgstr "Valeur courante" @@ -187,7 +190,7 @@ msgstr "Défaut" #: src/view/PreferencesPanel.cpp:159 #: src/view/PreferencesPanel.cpp:209 -#: src/view/AccountPanel.cpp:790 +#: src/view/AccountPanel.cpp:778 msgid "Delete" msgstr "Supprimer" @@ -211,7 +214,7 @@ msgstr "Description" #: src/view/PreferencesPanel.cpp:487 #: src/view/PreferencesPanel.cpp:526 #: src/view/PreferencesPanel.cpp:532 -#: src/view/AccountPanel.cpp:927 +#: src/view/AccountPanel.cpp:915 #: src/view/UsersDialog.cpp:86 #: src/view/UsersDialog.cpp:114 #: src/view/SearchPanel.cpp:134 @@ -225,7 +228,7 @@ msgstr "Erreur" msgid "Error creating original database" msgstr "Erreur durant la création de la base de données initiale" -#: src/view/AccountPanel.cpp:116 +#: src/view/AccountPanel.cpp:104 msgid "Final value" msgstr "Valeur finale" @@ -239,12 +242,16 @@ msgstr "Fixe" msgid "Font" msgstr "Police" +#: src/view/StatsPanel.cpp:62 +msgid "From" +msgstr "De" + #: src/view/GenerateDialog.cpp:45 msgid "From " msgstr "De" #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:787 +#: src/view/AccountPanel.cpp:775 msgid "Generate month" msgstr "Générer mois" @@ -256,7 +263,7 @@ msgstr "Courses" msgid "Hobbies" msgstr "Loisirs" -#: src/view/AccountPanel.cpp:114 +#: src/view/AccountPanel.cpp:102 msgid "Initial value" msgstr "Valeur initiale" @@ -274,7 +281,7 @@ msgstr "Montant max invalide" #: src/view/SearchPanel.cpp:134 msgid "Invalid date range" -msgstr "Intervalle des dates invalide" +msgstr "Intervalle de temps invalide" #: src/view/PreferencesPanel.cpp:526 msgid "Invalid name" @@ -288,11 +295,15 @@ msgstr "Ancien mot de passe invalide" msgid "Invalid password" msgstr "Mot de passe invalide" +#: src/view/StatsPanel.cpp:303 +msgid "Invalide date range" +msgstr "Intervalle de temps invalide" + #: src/view/PreferencesPanel.cpp:336 msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:927 +#: src/view/AccountPanel.cpp:915 msgid "It must be at least one month !" msgstr "Il doit rester au mois un mois" @@ -302,6 +313,7 @@ msgstr "Kill me" #: src/view/PreferencesPanel.cpp:566 #: src/view/PreferencesPanel.cpp:569 +#: src/view/StatsPanel.cpp:303 msgid "KissCount" msgstr "KissCount" @@ -366,7 +378,7 @@ msgstr "Frais de fonctionnement" msgid "Operation order" msgstr "Ordre des opérations" -#: src/view/ButtonPanel.cpp:46 +#: src/view/ButtonPanel.cpp:47 msgid "Operations" msgstr "Opérations" @@ -382,7 +394,7 @@ msgstr "Mot de passe" msgid "Password changed" msgstr "Mot de passe changé" -#: src/view/ButtonPanel.cpp:96 +#: src/view/ButtonPanel.cpp:102 msgid "" "Personal accounting software\n" "\n" @@ -398,29 +410,30 @@ msgstr "Re entrez le mot de passe" #: src/view/PreferencesPanel.cpp:540 #: src/view/PreferencesPanel.cpp:574 -#: src/view/ButtonPanel.cpp:49 +#: src/view/ButtonPanel.cpp:50 msgid "Preferences" msgstr "Préférences" -#: src/view/ButtonPanel.cpp:52 +#: src/view/ButtonPanel.cpp:53 msgid "Quit" msgstr "Quitter" -#: src/view/ButtonPanel.cpp:103 +#: src/view/ButtonPanel.cpp:109 msgid "Quit KissCount ?" msgstr "Quitter KissCount ?" -#: src/view/AccountPanel.cpp:195 +#: src/view/AccountPanel.cpp:183 msgid "Remains" msgstr "Restant" #: src/view/SearchPanel.cpp:78 #: src/view/SearchPanel.cpp:239 -#: src/view/ButtonPanel.cpp:48 +#: src/view/ButtonPanel.cpp:49 msgid "Search" msgstr "Chercher" -#: src/view/AccountPanel.cpp:97 +#: src/view/StatsPanel.cpp:122 +#: src/view/AccountPanel.cpp:85 msgid "Serie 1" msgstr "Série 1" @@ -428,19 +441,24 @@ msgstr "Série 1" msgid "Shared" msgstr "Partagé" -#: src/view/ButtonPanel.cpp:47 +#: src/view/StatsPanel.cpp:288 +#: src/view/ButtonPanel.cpp:48 msgid "Statistics" msgstr "Statistiques" +#: src/view/StatsPanel.cpp:69 +msgid "To" +msgstr "A" + #: src/view/GenerateDialog.cpp:52 msgid "To " msgstr "A" -#: src/view/AccountPanel.cpp:177 +#: src/view/AccountPanel.cpp:165 msgid "Total Credit" msgstr "Total Crédit" -#: src/view/AccountPanel.cpp:178 +#: src/view/AccountPanel.cpp:166 msgid "Total Debit" msgstr "Total Débit" @@ -468,51 +486,51 @@ msgstr "Utilisateur" msgid "Users" msgstr "Utilisateurs" -#: src/view/wxUI.cpp:97 +#: src/view/wxUI.cpp:110 msgid "april" msgstr "avril" -#: src/view/wxUI.cpp:101 +#: src/view/wxUI.cpp:114 msgid "august" msgstr "août" -#: src/view/wxUI.cpp:105 +#: src/view/wxUI.cpp:118 msgid "december" msgstr "décembre" -#: src/view/wxUI.cpp:95 +#: src/view/wxUI.cpp:108 msgid "february" msgstr "février" -#: src/view/wxUI.cpp:94 +#: src/view/wxUI.cpp:107 msgid "january" msgstr "janvier" -#: src/view/wxUI.cpp:100 +#: src/view/wxUI.cpp:113 msgid "july" msgstr "juillet" -#: src/view/wxUI.cpp:99 +#: src/view/wxUI.cpp:112 msgid "june" msgstr "juin" -#: src/view/wxUI.cpp:96 +#: src/view/wxUI.cpp:109 msgid "march" msgstr "mars" -#: src/view/wxUI.cpp:98 +#: src/view/wxUI.cpp:111 msgid "may" msgstr "mai" -#: src/view/wxUI.cpp:104 +#: src/view/wxUI.cpp:117 msgid "november" msgstr "novembre" -#: src/view/wxUI.cpp:103 +#: src/view/wxUI.cpp:116 msgid "october" msgstr "octobre" -#: src/view/wxUI.cpp:102 +#: src/view/wxUI.cpp:115 msgid "september" msgstr "septembre" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 1db8a98..ba88a0a 100644 --- a/ressources/po/kisscount.pot +++ b/ressources/po/kisscount.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-08-14 22:00+0200\n" +"POT-Creation-Date: 2010-08-18 20:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/PreferencesPanel.cpp:574 +#: src/view/PreferencesPanel.cpp:574 src/view/StatsPanel.cpp:288 msgid " - " msgstr "" @@ -34,7 +34,7 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:936 +#: src/view/AccountPanel.cpp:924 msgid " operations ?" msgstr "" @@ -46,7 +46,7 @@ msgstr "" msgid "1 entry found" msgstr "" -#: src/view/ButtonPanel.cpp:51 +#: src/view/ButtonPanel.cpp:52 msgid "About" msgstr "" @@ -58,15 +58,15 @@ msgstr "" msgid "Account " msgstr "" -#: src/view/AccountPanel.cpp:113 +#: src/view/AccountPanel.cpp:101 msgid "Account name" msgstr "" -#: src/view/AccountPanel.cpp:112 +#: src/view/AccountPanel.cpp:100 msgid "Account number" msgstr "" -#: src/view/PreferencesPanel.cpp:55 +#: src/view/PreferencesPanel.cpp:55 src/view/StatsPanel.cpp:256 msgid "Accounts" msgstr "" @@ -79,11 +79,11 @@ msgid "Amount to" msgstr "" #: src/view/PreferencesPanel.cpp:340 src/view/PreferencesPanel.cpp:581 -#: src/view/AccountPanel.cpp:931 +#: src/view/AccountPanel.cpp:919 msgid "Are you sure want to delete " msgstr "" -#: src/view/PreferencesPanel.cpp:449 src/view/AccountPanel.cpp:633 +#: src/view/PreferencesPanel.cpp:449 src/view/AccountPanel.cpp:621 #: src/view/SearchPanel.cpp:345 msgid "Are you sure want to delete : \n" msgstr "" @@ -121,7 +121,7 @@ msgstr "" msgid "Change password" msgstr "" -#: src/view/ButtonPanel.cpp:50 +#: src/view/ButtonPanel.cpp:51 msgid "Change user" msgstr "" @@ -133,7 +133,7 @@ msgstr "" msgid "Confirm password " msgstr "" -#: src/view/AccountPanel.cpp:123 +#: src/view/StatsPanel.cpp:130 src/view/AccountPanel.cpp:111 msgid "Cost repartition" msgstr "" @@ -141,15 +141,15 @@ msgstr "" msgid "Credit" msgstr "" -#: src/view/AccountPanel.cpp:193 +#: src/view/AccountPanel.cpp:181 msgid "Cur Credit" msgstr "" -#: src/view/AccountPanel.cpp:194 +#: src/view/AccountPanel.cpp:182 msgid "Cur Debit" msgstr "" -#: src/view/AccountPanel.cpp:115 +#: src/view/AccountPanel.cpp:103 msgid "Current value" msgstr "" @@ -174,7 +174,7 @@ msgid "Default" msgstr "" #: src/view/PreferencesPanel.cpp:159 src/view/PreferencesPanel.cpp:209 -#: src/view/AccountPanel.cpp:790 +#: src/view/AccountPanel.cpp:778 msgid "Delete" msgstr "" @@ -191,7 +191,7 @@ msgstr "" #: src/view/PreferencesPanel.cpp:336 src/view/PreferencesPanel.cpp:359 #: src/view/PreferencesPanel.cpp:378 src/view/PreferencesPanel.cpp:468 #: src/view/PreferencesPanel.cpp:487 src/view/PreferencesPanel.cpp:526 -#: src/view/PreferencesPanel.cpp:532 src/view/AccountPanel.cpp:927 +#: src/view/PreferencesPanel.cpp:532 src/view/AccountPanel.cpp:915 #: src/view/UsersDialog.cpp:86 src/view/UsersDialog.cpp:114 #: src/view/SearchPanel.cpp:134 src/view/SearchPanel.cpp:144 #: src/view/SearchPanel.cpp:158 src/view/SearchPanel.cpp:169 @@ -202,7 +202,7 @@ msgstr "" msgid "Error creating original database" msgstr "" -#: src/view/AccountPanel.cpp:116 +#: src/view/AccountPanel.cpp:104 msgid "Final value" msgstr "" @@ -215,11 +215,15 @@ msgstr "" msgid "Font" msgstr "" +#: src/view/StatsPanel.cpp:62 +msgid "From" +msgstr "" + #: src/view/GenerateDialog.cpp:45 msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:787 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:775 msgid "Generate month" msgstr "" @@ -231,7 +235,7 @@ msgstr "" msgid "Hobbies" msgstr "" -#: src/view/AccountPanel.cpp:114 +#: src/view/AccountPanel.cpp:102 msgid "Initial value" msgstr "" @@ -263,11 +267,15 @@ msgstr "" msgid "Invalid password" msgstr "" +#: src/view/StatsPanel.cpp:303 +msgid "Invalide date range" +msgstr "" + #: src/view/PreferencesPanel.cpp:336 msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:927 +#: src/view/AccountPanel.cpp:915 msgid "It must be at least one month !" msgstr "" @@ -276,6 +284,7 @@ msgid "Kill me" msgstr "" #: src/view/PreferencesPanel.cpp:566 src/view/PreferencesPanel.cpp:569 +#: src/view/StatsPanel.cpp:303 msgid "KissCount" msgstr "" @@ -337,7 +346,7 @@ msgstr "" msgid "Operation order" msgstr "" -#: src/view/ButtonPanel.cpp:46 +#: src/view/ButtonPanel.cpp:47 msgid "Operations" msgstr "" @@ -353,7 +362,7 @@ msgstr "" msgid "Password changed" msgstr "" -#: src/view/ButtonPanel.cpp:96 +#: src/view/ButtonPanel.cpp:102 msgid "" "Personal accounting software\n" "\n" @@ -365,28 +374,28 @@ msgid "Please retype new password" msgstr "" #: src/view/PreferencesPanel.cpp:540 src/view/PreferencesPanel.cpp:574 -#: src/view/ButtonPanel.cpp:49 +#: src/view/ButtonPanel.cpp:50 msgid "Preferences" msgstr "" -#: src/view/ButtonPanel.cpp:52 +#: src/view/ButtonPanel.cpp:53 msgid "Quit" msgstr "" -#: src/view/ButtonPanel.cpp:103 +#: src/view/ButtonPanel.cpp:109 msgid "Quit KissCount ?" msgstr "" -#: src/view/AccountPanel.cpp:195 +#: src/view/AccountPanel.cpp:183 msgid "Remains" msgstr "" #: src/view/SearchPanel.cpp:78 src/view/SearchPanel.cpp:239 -#: src/view/ButtonPanel.cpp:48 +#: src/view/ButtonPanel.cpp:49 msgid "Search" msgstr "" -#: src/view/AccountPanel.cpp:97 +#: src/view/StatsPanel.cpp:122 src/view/AccountPanel.cpp:85 msgid "Serie 1" msgstr "" @@ -394,19 +403,23 @@ msgstr "" msgid "Shared" msgstr "" -#: src/view/ButtonPanel.cpp:47 +#: src/view/StatsPanel.cpp:288 src/view/ButtonPanel.cpp:48 msgid "Statistics" msgstr "" +#: src/view/StatsPanel.cpp:69 +msgid "To" +msgstr "" + #: src/view/GenerateDialog.cpp:52 msgid "To " msgstr "" -#: src/view/AccountPanel.cpp:177 +#: src/view/AccountPanel.cpp:165 msgid "Total Credit" msgstr "" -#: src/view/AccountPanel.cpp:178 +#: src/view/AccountPanel.cpp:166 msgid "Total Debit" msgstr "" @@ -431,50 +444,50 @@ msgstr "" msgid "Users" msgstr "" -#: src/view/wxUI.cpp:97 +#: src/view/wxUI.cpp:110 msgid "april" msgstr "" -#: src/view/wxUI.cpp:101 +#: src/view/wxUI.cpp:114 msgid "august" msgstr "" -#: src/view/wxUI.cpp:105 +#: src/view/wxUI.cpp:118 msgid "december" msgstr "" -#: src/view/wxUI.cpp:95 +#: src/view/wxUI.cpp:108 msgid "february" msgstr "" -#: src/view/wxUI.cpp:94 +#: src/view/wxUI.cpp:107 msgid "january" msgstr "" -#: src/view/wxUI.cpp:100 +#: src/view/wxUI.cpp:113 msgid "july" msgstr "" -#: src/view/wxUI.cpp:99 +#: src/view/wxUI.cpp:112 msgid "june" msgstr "" -#: src/view/wxUI.cpp:96 +#: src/view/wxUI.cpp:109 msgid "march" msgstr "" -#: src/view/wxUI.cpp:98 +#: src/view/wxUI.cpp:111 msgid "may" msgstr "" -#: src/view/wxUI.cpp:104 +#: src/view/wxUI.cpp:117 msgid "november" msgstr "" -#: src/view/wxUI.cpp:103 +#: src/view/wxUI.cpp:116 msgid "october" msgstr "" -#: src/view/wxUI.cpp:102 +#: src/view/wxUI.cpp:115 msgid "september" msgstr "" diff --git a/src/model/Database.cpp b/src/model/Database.cpp index ec50936..8798049 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -1071,6 +1071,8 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y for (accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++) { req = wxT("SELECT month, year, amount FROM account_amount WHERE account ='") + accountIt->id + wxT("'"); + req += wxT(" AND (year > '") + yearFrom + wxT("' OR (year == '") + yearFrom + wxT("' AND month >= '") + monthFrom + wxT("'))"); + req += wxT(" AND (year < '") + yearTo + wxT("' OR (year == '") + yearTo + wxT("' AND month <= '") + monthTo + wxT("'))"); EXECUTE_SQL_QUERY(req, set, ); @@ -1095,7 +1097,6 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y req += wxT(" OR user='") + user->_id + wxT("')"); req += wxT(" AND (year > '") + yearFrom + wxT("' OR (year == '") + yearFrom + wxT("' AND month >= '") + monthFrom + wxT("'))"); - req += wxT(" AND (year < '") + yearTo + wxT("' OR (year == '") + yearTo + wxT("' AND month <= '") + monthTo + wxT("'))"); req += wxT(" AND amount < 0"); diff --git a/src/view/StatsPanel.cpp b/src/view/StatsPanel.cpp index 71abf23..1a192a5 100644 --- a/src/view/StatsPanel.cpp +++ b/src/view/StatsPanel.cpp @@ -19,24 +19,65 @@ along with KissCount. If not, see . #include "StatsPanel.h" -StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent) +enum {RANGE_ID=1, ACCOUNTS_ID}; + +BEGIN_EVENT_TABLE(StatsPanel, wxPanel) +EVT_CHOICE(RANGE_ID, StatsPanel::OnRangeChange) +EVT_CHECKLISTBOX(ACCOUNTS_ID, StatsPanel::OnAccountsChange) +END_EVENT_TABLE() + +StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _kiss(kiss), _wxUI(parent), _plot(NULL), _chart(NULL) { wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); - wxBoxSizer *hbox2 = new wxBoxSizer(wxHORIZONTAL); + _hbox2 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL); - wxBoxSizer *vbox2 = new wxBoxSizer(wxVERTICAL); + _vbox2 = new wxBoxSizer(wxVERTICAL); int i; User* user = _kiss->GetUser(); std::vector::iterator accountIt; std::vector::iterator categoryIt; + std::map > operations; + std::map >::iterator it; SetSizer(vbox); - _monthFrom = new wxChoice (this, -1, wxDefaultPosition, wxDefaultSize, 12, months); - _monthTo = new wxChoice (this, -1, wxDefaultPosition, wxDefaultSize, 12, months); + _monthFrom = new wxChoice (this, RANGE_ID, wxDefaultPosition, wxDefaultSize, 12, months); + _yearFrom = new wxChoice (this, RANGE_ID); + _monthTo = new wxChoice (this, RANGE_ID, wxDefaultPosition, wxDefaultSize, 12, months); + _yearTo = new wxChoice (this, RANGE_ID); + operations = _kiss->GetAllOperations(); + + for(i=0, it = operations.begin(); it != operations.end(); it++, i++) + { + _yearFrom->Append(wxString::Format(wxT("%d"), it->first)); + _yearTo->Append(wxString::Format(wxT("%d"), it->first)); + } + + _monthFrom->Select(0); + _monthTo->Select(11); + _yearFrom->Select(i); + _yearTo->Select(i); + + wxStaticText* label = new wxStaticText(this, wxID_ANY, _("From")); + hbox->Add(label); + hbox->Add(-1, 10); hbox->Add(_monthFrom); + hbox->Add(_yearFrom); + + hbox->Add(-1, 30); + label = new wxStaticText(this, wxID_ANY, _("To")); + hbox->Add(label); + hbox->Add(-1, 10); hbox->Add(_monthTo); + hbox->Add(_yearTo); + + _account = new wxCheckListBox(this, ACCOUNTS_ID); + for(i=0, accountIt = user->_accounts.begin(); accountIt != user->_accounts.end(); accountIt++, i++) + { + _account->Append(accountIt->name); + _account->Check(i); + } _categories = new wxString[user->GetCategoriesNumber()] ; for(i=0, categoryIt = user->_categories.begin(); @@ -65,7 +106,9 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki _statsGrid->SetCellAlignment(i, 1, wxALIGN_RIGHT, wxALIGN_CENTRE); } - vbox2->Add(_statsGrid); + _vbox2->Add(_account); + _vbox2->Add(-1, 10); + _vbox2->Add(_statsGrid); _pie = new PiePlot(); @@ -90,20 +133,21 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent) : wxPanel(&(*parent)), _ki chart->SetMinSize(// chart->GetSize() wxSize(200,250)); - UpdateStats(hbox2); + wxCommandEvent event ; + OnRangeChange(event); - vbox2->Add(chart); + _vbox2->Add(-1, 10); + _vbox2->Add(chart); - hbox2->Add(vbox2); vbox->Add(hbox); - vbox->Add(hbox2); + vbox->Add(_hbox2); Fit(); Hide(); } -void StatsPanel::UpdateStats(wxBoxSizer *hbox2) +void StatsPanel::UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearTo) { std::map > > accountAmounts; std::map categories; @@ -111,12 +155,19 @@ void StatsPanel::UpdateStats(wxBoxSizer *hbox2) std::map > >::iterator accountIdIt; std::map >::iterator accountYearIt; double total; - int size, i, a, b, percents; + int size, i, a, b, percents, account; double *amounts; - User* user = _kiss->GetUser(); wxString value; + User* user = _kiss->GetUser(); - _kiss->GetStats(0, 2010, 11, 2010, &accountAmounts, &categories); + if (_chart) + { + _hbox2->Detach(_chart); + _hbox2->Detach(_vbox2); + delete _chart; + } + + _kiss->GetStats(monthFrom, yearFrom, monthTo, yearTo, &accountAmounts, &categories); // first step: create plot _plot = new XYPlot(); @@ -124,9 +175,30 @@ void StatsPanel::UpdateStats(wxBoxSizer *hbox2) // create dataset XYSimpleDataset *dataset = new XYSimpleDataset(); - // add two series - for (i = 0, accountIdIt = accountAmounts.begin(); accountIdIt != accountAmounts.end(); accountIdIt++, i++) + // Line on 0 all over the years + size = ((yearTo - yearFrom) + 1) * 12; + amounts = new double[size*2]; + for (a=0; a<(size/12); a++) { + for(b=0; b<12; b++) + { + amounts[a*12*2+b*2+0] = a*12+b; + amounts[a*12*2+b*2+1] = 0; + } + } + + dataset->AddSerie((double *) amounts, size); + delete[] amounts; + + for (account = 0, i = 0, accountIdIt = accountAmounts.begin(); accountIdIt != accountAmounts.end(); + accountIdIt++, i++, account++) + { + if (!((wxCheckListBox*)_account)->IsChecked(account)) + { + i-- ; + continue; + } + size = accountAmounts[accountIdIt->first].size(); amounts = new double[size*12*2]; size = 0; @@ -145,12 +217,12 @@ void StatsPanel::UpdateStats(wxBoxSizer *hbox2) } dataset->AddSerie((double *) amounts, size); // set serie names to be displayed on legend - dataset->SetSerieName(i, user->GetAccountName(accountIdIt->first)); + dataset->SetSerieName(i+1, user->GetAccountName(accountIdIt->first)); delete[] amounts; } // create line renderer and set it to dataset - XYLineRenderer *renderer = new XYLineRenderer(); + XYLineRenderer *renderer = new XYLineRenderer(true, true); dataset->SetRenderer(renderer); // add our dataset to plot @@ -168,26 +240,17 @@ void StatsPanel::UpdateStats(wxBoxSizer *hbox2) _plot->LinkDataVerticalAxis(0, 0); _plot->LinkDataHorizontalAxis(0, 0); - // create line marker - LineMarker *lineMarker = new LineMarker(wxColour(255, 0, 0), 2); - - // set value to be marked, in our case horizontal value 15 - lineMarker->SetHorizontalLine(25); - - // and add marker to dataset - dataset->AddMarker(lineMarker); - // set legend _plot->SetLegend(new Legend(wxCENTER, wxRIGHT)); - wxChartPanel* chart = new wxChartPanel(this); - chart->SetChart(new Chart(_plot, _("Accounts"))); - chart->Fit(); - chart->Layout(); - chart->SetMinSize(// chart->GetSize() + _chart = new wxChartPanel(this); + _chart->SetChart(new Chart(_plot, _("Accounts"))); + _chart->Fit(); + _chart->Layout(); + _chart->SetMinSize(// chart->GetSize() wxSize(750,550)); - hbox2->Add(chart); + _hbox2->Add(_chart); total = 0.0; for(categoriesIt = categories.begin(); categoriesIt != categories.end(); categoriesIt++) @@ -205,6 +268,10 @@ void StatsPanel::UpdateStats(wxBoxSizer *hbox2) _statsGrid->AutoSizeColumn(1, true); _pie->DatasetChanged(_dataset); + + _hbox2->Add(_vbox2); + + Layout(); } void StatsPanel::OnShow(wxShowEvent& event) @@ -212,3 +279,26 @@ void StatsPanel::OnShow(wxShowEvent& event) _wxUI->SetTitle(_kiss->GetUser()->_name + _(" - ") + _("Statistics")); } +void StatsPanel::OnRangeChange(wxCommandEvent& event) +{ + int monthFrom, monthTo, yearFrom, yearTo; + + monthFrom = _monthFrom->GetCurrentSelection(); + _yearFrom->GetStringSelection().ToLong((long*)&yearFrom); + monthTo = _monthTo->GetCurrentSelection(); + _yearTo->GetStringSelection().ToLong((long*)&yearTo); + + if (yearTo > yearFrom || + (yearFrom == yearTo && monthFrom >= monthTo)) + { + wxMessageBox(_("Invalide date range"), _("KissCount"), wxICON_ERROR | wxOK); + return; + } + + UpdateStats(monthFrom, yearFrom, monthTo, yearTo); +} + +void StatsPanel::OnAccountsChange(wxCommandEvent& event) +{ + OnRangeChange(event); +} diff --git a/src/view/StatsPanel.h b/src/view/StatsPanel.h index 2ca6454..7daaee8 100644 --- a/src/view/StatsPanel.h +++ b/src/view/StatsPanel.h @@ -61,11 +61,16 @@ class StatsPanel: public wxPanel //public wxScrolledWindow XYPlot *_plot ; wxString* _categories; std::map _categoriesIndexes; + wxBoxSizer *_hbox2, *_vbox2; + wxChartPanel* _chart; + wxCheckListBox* _account; - void UpdateStats(wxBoxSizer *); + void UpdateStats(int monthFrom, int yearFrom, int monthTo, int yearTo); - //DECLARE_EVENT_TABLE(); + void OnRangeChange(wxCommandEvent& event); + void OnAccountsChange(wxCommandEvent& event); + DECLARE_EVENT_TABLE(); }; #endif