From 0832e020c4c6735abb6be70aa4237dbd51e8bd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 1 Nov 2010 11:34:39 +0100 Subject: [PATCH] Add blocked account (mainly for statistics) Really fix the previous bug --- init.sql | 2 +- ressources/po/french.mo | Bin 7112 -> 7144 bytes ressources/po/french.po | 108 ++++++++++++++++++---------------- ressources/po/kisscount.pot | 88 ++++++++++++++------------- src/model/Account.h | 1 + src/model/Database.cpp | 36 ++++++++++-- src/model/User.cpp | 8 +++ src/model/User.h | 1 + src/view/AccountPanel.cpp | 75 +++++++++++++++-------- src/view/PreferencesPanel.cpp | 28 ++++++++- src/view/wxUI.cpp | 3 + 11 files changed, 220 insertions(+), 130 deletions(-) diff --git a/init.sql b/init.sql index 9584c1c..08b9bcc 100644 --- a/init.sql +++ b/init.sql @@ -1,6 +1,6 @@ CREATE TABLE kisscount(db_version VARCHAR(20)); CREATE TABLE user (id INTEGER PRIMARY KEY, name VARCHAR(255), password VARCHAR(255)); -CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), default_account CHAR(1)); +CREATE TABLE account(id INTEGER PRIMARY KEY, user REFERENCES user(id), name VARCHAR(255), number VARCHAR(255), shared CHAR(1), blocked CHAR(1), default_account CHAR(1)); CREATE TABLE shared_account(account REFERENCES account(id), user REFERENCES user(id)); CREATE TABLE account_amount(id INTEGER PRIMARY KEY, account REFERENCES account(id), year INTEGER, month INTEGER, amount FLOAT); CREATE TABLE operation(id INTEGER PRIMARY KEY, parent REFERENCES operation(id), user REFERENCES user(id), account REFERENCES account(id), year INTEGER, month INTEGER, day INTEGER, amount FLOAT, description VARCHAR(255), category REFERENCES category(id), fix_cost CHAR(1), checked CHAR(1), formula VARCHAR(255), transfert REFERENCES operation(id), meta CHAR(1)); diff --git a/ressources/po/french.mo b/ressources/po/french.mo index 36c8befa3eb7c93a255b4015b1431bc6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pDPdi#8ZEDJM)JMo!V zpNYP!BZvxOHes2OAxy=^#FO#bv-JNmgd2;92MCT;m`hkVz;?~4B_5C?uKtl(O$;Wc6PAg@=u~@;+D@rqy*j$&l#Li&mKar5Il8>GY*cD!{*KP6 JV+Dh<{{u~#+tUC5 diff --git a/ressources/po/french.po b/ressources/po/french.po index a4d6f49..0c40e77 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-10-30 20:31+0200\n" +"POT-Creation-Date: 2010-11-01 11:34+0100\n" "PO-Revision-Date: \n" "Last-Translator: Soutadé \n" "Language-Team: \n" @@ -20,20 +20,20 @@ msgstr "" # FIRST AUTHOR , YEAR. # #: src/view/StatsPanel.cpp:282 -#: src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:767 msgid " - " msgstr " - " #: src/view/UsersDialog.cpp:118 -#: src/view/PreferencesPanel.cpp:406 -#: src/view/PreferencesPanel.cpp:425 -#: src/view/PreferencesPanel.cpp:638 -#: src/view/PreferencesPanel.cpp:657 -#: src/view/PreferencesPanel.cpp:703 +#: src/view/PreferencesPanel.cpp:420 +#: src/view/PreferencesPanel.cpp:439 +#: src/view/PreferencesPanel.cpp:660 +#: src/view/PreferencesPanel.cpp:679 +#: src/view/PreferencesPanel.cpp:725 msgid " already exists" msgstr " existe déjà " -#: src/view/SearchPanel.cpp:227 +#: src/view/SearchPanel.cpp:222 msgid " entries found" msgstr " entrées trouvées" @@ -41,11 +41,11 @@ msgstr " entrées trouvées" msgid " not found, aborting" msgstr " non trouvé, arrêt" -#: src/view/AccountPanel.cpp:709 +#: src/view/AccountPanel.cpp:727 msgid " operations ?" msgstr " opérations ?" -#: src/view/PreferencesPanel.cpp:752 +#: src/view/PreferencesPanel.cpp:774 msgid " profil ?" msgstr " profil ?" @@ -53,7 +53,7 @@ msgstr " profil ?" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "!! Attention !! S'il y a eu un bug, l'ancienne base de donnée va être supprimée !" -#: src/view/SearchPanel.cpp:229 +#: src/view/SearchPanel.cpp:224 msgid "1 entry found" msgstr "1 entrée trouvée" @@ -66,8 +66,8 @@ msgstr "A propos" msgid "Account" msgstr "Compte" -#: src/view/PreferencesPanel.cpp:406 -#: src/view/PreferencesPanel.cpp:425 +#: src/view/PreferencesPanel.cpp:420 +#: src/view/PreferencesPanel.cpp:439 msgid "Account " msgstr "Le compte " @@ -92,25 +92,29 @@ msgstr "Montant min" msgid "Amount to" msgstr "Montant max" -#: src/view/PreferencesPanel.cpp:387 -#: src/view/PreferencesPanel.cpp:752 -#: src/view/AccountPanel.cpp:704 +#: src/view/PreferencesPanel.cpp:401 +#: src/view/PreferencesPanel.cpp:774 +#: src/view/AccountPanel.cpp:722 msgid "Are you sure want to delete " msgstr "Etes vous sûr de vouloir supprimer " -#: src/view/PreferencesPanel.cpp:619 +#: src/view/PreferencesPanel.cpp:641 #: src/view/grid/GridAccount.cpp:760 msgid "Are you sure want to delete : \n" msgstr "Etes vous sûr de vouloir supprimer : \n" -#: src/view/PreferencesPanel.cpp:308 +#: src/view/PreferencesPanel.cpp:315 msgid "Ascending" msgstr "Croissant" -#: src/view/PreferencesPanel.cpp:247 +#: src/view/PreferencesPanel.cpp:254 msgid "Background color" msgstr "Couleur d'arrière plan" +#: src/view/PreferencesPanel.cpp:187 +msgid "Blocked" +msgstr "Bloqué" + #: src/view/SearchPanel.cpp:76 msgid "Both" msgstr "Les deux" @@ -140,8 +144,8 @@ msgstr "Catégories" msgid "Category" msgstr "Catégorie" -#: src/view/PreferencesPanel.cpp:638 -#: src/view/PreferencesPanel.cpp:657 +#: src/view/PreferencesPanel.cpp:660 +#: src/view/PreferencesPanel.cpp:679 msgid "Category " msgstr "Catégorie" @@ -210,13 +214,13 @@ msgstr "Débit" msgid "Default" msgstr "Défaut" -#: src/view/PreferencesPanel.cpp:187 -#: src/view/PreferencesPanel.cpp:250 -#: src/view/AccountPanel.cpp:563 +#: src/view/PreferencesPanel.cpp:188 +#: src/view/PreferencesPanel.cpp:257 +#: src/view/AccountPanel.cpp:578 msgid "Delete" msgstr "Supprimer" -#: src/view/PreferencesPanel.cpp:309 +#: src/view/PreferencesPanel.cpp:316 msgid "Descending" msgstr "Décroissant" @@ -231,16 +235,16 @@ msgstr "Description" #: src/view/SearchPanel.cpp:150 #: src/view/SearchPanel.cpp:164 #: src/view/SearchPanel.cpp:175 -#: src/view/PreferencesPanel.cpp:383 -#: src/view/PreferencesPanel.cpp:406 -#: src/view/PreferencesPanel.cpp:425 -#: src/view/PreferencesPanel.cpp:638 -#: src/view/PreferencesPanel.cpp:657 -#: src/view/PreferencesPanel.cpp:697 -#: src/view/PreferencesPanel.cpp:703 +#: src/view/PreferencesPanel.cpp:397 +#: src/view/PreferencesPanel.cpp:420 +#: src/view/PreferencesPanel.cpp:439 +#: src/view/PreferencesPanel.cpp:660 +#: src/view/PreferencesPanel.cpp:679 +#: src/view/PreferencesPanel.cpp:719 +#: src/view/PreferencesPanel.cpp:725 #: src/view/PasswordDialog.cpp:72 #: src/view/PasswordDialog.cpp:78 -#: src/view/AccountPanel.cpp:700 +#: src/view/AccountPanel.cpp:718 #: src/view/grid/GridAccount.cpp:1144 #: src/view/grid/GridAccount.cpp:1151 #: src/view/grid/GridAccount.cpp:1280 @@ -267,16 +271,16 @@ msgstr "Valeur finale" #: src/view/SearchPanel.cpp:76 #: src/view/grid/GridAccount.cpp:300 -#: src/model/Database.cpp:329 +#: src/model/Database.cpp:331 #: src/controller/KissCount.cpp:335 msgid "Fix" msgstr "Fixe" -#: src/view/PreferencesPanel.cpp:249 +#: src/view/PreferencesPanel.cpp:256 msgid "Font" msgstr "Police" -#: src/view/PreferencesPanel.cpp:248 +#: src/view/PreferencesPanel.cpp:255 msgid "Foreground color" msgstr "Couleur d'avant plan" @@ -289,7 +293,7 @@ msgid "From " msgstr "A partir de " #: src/view/GenerateDialog.cpp:31 -#: src/view/AccountPanel.cpp:560 +#: src/view/AccountPanel.cpp:575 msgid "Generate month" msgstr "Générer mois" @@ -329,7 +333,7 @@ msgstr "Intervalle de temps invalide" msgid "Invalid formula !" msgstr "Formule invalide !" -#: src/view/PreferencesPanel.cpp:697 +#: src/view/PreferencesPanel.cpp:719 msgid "Invalid name" msgstr "Nom invalide" @@ -345,11 +349,11 @@ msgstr "Mot de passe invalide" msgid "Invalide date range" msgstr "Intervalle de temps invalide" -#: src/view/PreferencesPanel.cpp:383 +#: src/view/PreferencesPanel.cpp:397 msgid "It must be at least one account !" msgstr "Il doit y avoir au moins un compte !" -#: src/view/AccountPanel.cpp:700 +#: src/view/AccountPanel.cpp:718 msgid "It must be at least one month !" msgstr "Il doit rester au mois un mois" @@ -358,8 +362,8 @@ msgid "Kill me" msgstr "Kill me" #: src/view/StatsPanel.cpp:302 -#: src/view/PreferencesPanel.cpp:737 -#: src/view/PreferencesPanel.cpp:740 +#: src/view/PreferencesPanel.cpp:759 +#: src/view/PreferencesPanel.cpp:762 msgid "KissCount" msgstr "KissCount" @@ -367,21 +371,21 @@ msgstr "KissCount" msgid "Language" msgstr "Langue" -#: src/view/PreferencesPanel.cpp:740 +#: src/view/PreferencesPanel.cpp:762 msgid "Language not changed" msgstr "Langue non changée" -#: src/view/PreferencesPanel.cpp:737 +#: src/view/PreferencesPanel.cpp:759 msgid "Language successfully changed, please go to another panel" msgstr "Langue changée, allez sur un autre panneau pour rendre le changement effectif" #: src/view/PreferencesPanel.cpp:71 #: src/view/PreferencesPanel.cpp:184 -#: src/view/PreferencesPanel.cpp:246 +#: src/view/PreferencesPanel.cpp:253 msgid "Name" msgstr "Nom" -#: src/view/PreferencesPanel.cpp:709 +#: src/view/PreferencesPanel.cpp:731 msgid "Name changed" msgstr "Nom changé" @@ -402,7 +406,7 @@ msgstr "" "Aucune base de données trouvée, voulez vous en créer une nouvelle ?\n" "\n" -#: src/view/SearchPanel.cpp:232 +#: src/view/SearchPanel.cpp:227 msgid "No entry found" msgstr "Pas d'entrée trouvée" @@ -467,8 +471,8 @@ msgstr "" msgid "Please retype new password" msgstr "Re entrez le mot de passe" -#: src/view/PreferencesPanel.cpp:711 -#: src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:733 +#: src/view/PreferencesPanel.cpp:767 #: src/view/ButtonPanel.cpp:72 msgid "Preferences" msgstr "Préférences" @@ -490,7 +494,7 @@ msgid "Remains" msgstr "Restant" #: src/view/SearchPanel.cpp:83 -#: src/view/SearchPanel.cpp:243 +#: src/view/SearchPanel.cpp:238 #: src/view/ButtonPanel.cpp:71 msgid "Search" msgstr "Chercher" @@ -542,7 +546,7 @@ msgstr "Exceptionnel" #: src/model/User.cpp:52 #: src/model/User.cpp:72 -#: src/model/User.cpp:112 +#: src/model/User.cpp:120 msgid "Unknown" msgstr "Inconnu" @@ -556,7 +560,7 @@ msgstr "Utilisateur" #: src/view/UsersDialog.cpp:38 #: src/view/UsersDialog.cpp:118 -#: src/view/PreferencesPanel.cpp:703 +#: src/view/PreferencesPanel.cpp:725 msgid "User " msgstr "Utilisateur" diff --git a/ressources/po/kisscount.pot b/ressources/po/kisscount.pot index 2aae4c7..c25267b 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-10-30 20:52+0200\n" +"POT-Creation-Date: 2010-11-01 11:34+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,17 +17,17 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/view/StatsPanel.cpp:282 src/view/PreferencesPanel.cpp:745 +#: src/view/StatsPanel.cpp:282 src/view/PreferencesPanel.cpp:767 msgid " - " msgstr "" -#: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:406 -#: src/view/PreferencesPanel.cpp:425 src/view/PreferencesPanel.cpp:638 -#: src/view/PreferencesPanel.cpp:657 src/view/PreferencesPanel.cpp:703 +#: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:420 +#: src/view/PreferencesPanel.cpp:439 src/view/PreferencesPanel.cpp:660 +#: src/view/PreferencesPanel.cpp:679 src/view/PreferencesPanel.cpp:725 msgid " already exists" msgstr "" -#: src/view/SearchPanel.cpp:227 +#: src/view/SearchPanel.cpp:222 msgid " entries found" msgstr "" @@ -35,11 +35,11 @@ msgstr "" msgid " not found, aborting" msgstr "" -#: src/view/AccountPanel.cpp:709 +#: src/view/AccountPanel.cpp:727 msgid " operations ?" msgstr "" -#: src/view/PreferencesPanel.cpp:752 +#: src/view/PreferencesPanel.cpp:774 msgid " profil ?" msgstr "" @@ -47,7 +47,7 @@ msgstr "" msgid "!! Warning !! If there was a bug, the old database will be suppressed !" msgstr "" -#: src/view/SearchPanel.cpp:229 +#: src/view/SearchPanel.cpp:224 msgid "1 entry found" msgstr "" @@ -59,7 +59,7 @@ msgstr "" msgid "Account" msgstr "" -#: src/view/PreferencesPanel.cpp:406 src/view/PreferencesPanel.cpp:425 +#: src/view/PreferencesPanel.cpp:420 src/view/PreferencesPanel.cpp:439 msgid "Account " msgstr "" @@ -83,23 +83,27 @@ msgstr "" msgid "Amount to" msgstr "" -#: src/view/PreferencesPanel.cpp:387 src/view/PreferencesPanel.cpp:752 -#: src/view/AccountPanel.cpp:704 +#: src/view/PreferencesPanel.cpp:401 src/view/PreferencesPanel.cpp:774 +#: src/view/AccountPanel.cpp:722 msgid "Are you sure want to delete " msgstr "" -#: src/view/PreferencesPanel.cpp:619 src/view/grid/GridAccount.cpp:760 +#: src/view/PreferencesPanel.cpp:641 src/view/grid/GridAccount.cpp:760 msgid "Are you sure want to delete : \n" msgstr "" -#: src/view/PreferencesPanel.cpp:308 +#: src/view/PreferencesPanel.cpp:315 msgid "Ascending" msgstr "" -#: src/view/PreferencesPanel.cpp:247 +#: src/view/PreferencesPanel.cpp:254 msgid "Background color" msgstr "" +#: src/view/PreferencesPanel.cpp:187 +msgid "Blocked" +msgstr "" + #: src/view/SearchPanel.cpp:76 msgid "Both" msgstr "" @@ -125,7 +129,7 @@ msgstr "" msgid "Category" msgstr "" -#: src/view/PreferencesPanel.cpp:638 src/view/PreferencesPanel.cpp:657 +#: src/view/PreferencesPanel.cpp:660 src/view/PreferencesPanel.cpp:679 msgid "Category " msgstr "" @@ -193,12 +197,12 @@ msgstr "" msgid "Default" msgstr "" -#: src/view/PreferencesPanel.cpp:187 src/view/PreferencesPanel.cpp:250 -#: src/view/AccountPanel.cpp:563 +#: src/view/PreferencesPanel.cpp:188 src/view/PreferencesPanel.cpp:257 +#: src/view/AccountPanel.cpp:578 msgid "Delete" msgstr "" -#: src/view/PreferencesPanel.cpp:309 +#: src/view/PreferencesPanel.cpp:316 msgid "Descending" msgstr "" @@ -209,11 +213,11 @@ msgstr "" #: src/view/UsersDialog.cpp:88 src/view/UsersDialog.cpp:118 #: src/view/SearchPanel.cpp:140 src/view/SearchPanel.cpp:150 #: src/view/SearchPanel.cpp:164 src/view/SearchPanel.cpp:175 -#: src/view/PreferencesPanel.cpp:383 src/view/PreferencesPanel.cpp:406 -#: src/view/PreferencesPanel.cpp:425 src/view/PreferencesPanel.cpp:638 -#: src/view/PreferencesPanel.cpp:657 src/view/PreferencesPanel.cpp:697 -#: src/view/PreferencesPanel.cpp:703 src/view/PasswordDialog.cpp:72 -#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:700 +#: src/view/PreferencesPanel.cpp:397 src/view/PreferencesPanel.cpp:420 +#: src/view/PreferencesPanel.cpp:439 src/view/PreferencesPanel.cpp:660 +#: src/view/PreferencesPanel.cpp:679 src/view/PreferencesPanel.cpp:719 +#: src/view/PreferencesPanel.cpp:725 src/view/PasswordDialog.cpp:72 +#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:718 #: src/view/grid/GridAccount.cpp:1144 src/view/grid/GridAccount.cpp:1151 #: src/view/grid/GridAccount.cpp:1280 src/view/grid/GridAccount.cpp:1286 #: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38 @@ -233,15 +237,15 @@ msgid "Final value" msgstr "" #: src/view/SearchPanel.cpp:76 src/view/grid/GridAccount.cpp:300 -#: src/model/Database.cpp:329 src/controller/KissCount.cpp:335 +#: src/model/Database.cpp:331 src/controller/KissCount.cpp:335 msgid "Fix" msgstr "" -#: src/view/PreferencesPanel.cpp:249 +#: src/view/PreferencesPanel.cpp:256 msgid "Font" msgstr "" -#: src/view/PreferencesPanel.cpp:248 +#: src/view/PreferencesPanel.cpp:255 msgid "Foreground color" msgstr "" @@ -253,7 +257,7 @@ msgstr "" msgid "From " msgstr "" -#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:560 +#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:575 msgid "Generate month" msgstr "" @@ -293,7 +297,7 @@ msgstr "" msgid "Invalid formula !" msgstr "" -#: src/view/PreferencesPanel.cpp:697 +#: src/view/PreferencesPanel.cpp:719 msgid "Invalid name" msgstr "" @@ -309,11 +313,11 @@ msgstr "" msgid "Invalide date range" msgstr "" -#: src/view/PreferencesPanel.cpp:383 +#: src/view/PreferencesPanel.cpp:397 msgid "It must be at least one account !" msgstr "" -#: src/view/AccountPanel.cpp:700 +#: src/view/AccountPanel.cpp:718 msgid "It must be at least one month !" msgstr "" @@ -321,8 +325,8 @@ msgstr "" msgid "Kill me" msgstr "" -#: src/view/StatsPanel.cpp:302 src/view/PreferencesPanel.cpp:737 -#: src/view/PreferencesPanel.cpp:740 +#: src/view/StatsPanel.cpp:302 src/view/PreferencesPanel.cpp:759 +#: src/view/PreferencesPanel.cpp:762 msgid "KissCount" msgstr "" @@ -330,20 +334,20 @@ msgstr "" msgid "Language" msgstr "" -#: src/view/PreferencesPanel.cpp:740 +#: src/view/PreferencesPanel.cpp:762 msgid "Language not changed" msgstr "" -#: src/view/PreferencesPanel.cpp:737 +#: src/view/PreferencesPanel.cpp:759 msgid "Language successfully changed, please go to another panel" msgstr "" #: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:184 -#: src/view/PreferencesPanel.cpp:246 +#: src/view/PreferencesPanel.cpp:253 msgid "Name" msgstr "" -#: src/view/PreferencesPanel.cpp:709 +#: src/view/PreferencesPanel.cpp:731 msgid "Name changed" msgstr "" @@ -361,7 +365,7 @@ msgid "" "\n" msgstr "" -#: src/view/SearchPanel.cpp:232 +#: src/view/SearchPanel.cpp:227 msgid "No entry found" msgstr "" @@ -419,7 +423,7 @@ msgstr "" msgid "Please retype new password" msgstr "" -#: src/view/PreferencesPanel.cpp:711 src/view/PreferencesPanel.cpp:745 +#: src/view/PreferencesPanel.cpp:733 src/view/PreferencesPanel.cpp:767 #: src/view/ButtonPanel.cpp:72 msgid "Preferences" msgstr "" @@ -440,7 +444,7 @@ msgstr "" msgid "Remains" msgstr "" -#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:243 +#: src/view/SearchPanel.cpp:83 src/view/SearchPanel.cpp:238 #: src/view/ButtonPanel.cpp:71 msgid "Search" msgstr "" @@ -486,7 +490,7 @@ msgstr "" msgid "Unexpected" msgstr "" -#: src/model/User.cpp:52 src/model/User.cpp:72 src/model/User.cpp:112 +#: src/model/User.cpp:52 src/model/User.cpp:72 src/model/User.cpp:120 msgid "Unknown" msgstr "" @@ -499,7 +503,7 @@ msgid "User" msgstr "" #: src/view/UsersDialog.cpp:38 src/view/UsersDialog.cpp:118 -#: src/view/PreferencesPanel.cpp:703 +#: src/view/PreferencesPanel.cpp:725 msgid "User " msgstr "" diff --git a/src/model/Account.h b/src/model/Account.h index ae2f438..7c56b71 100644 --- a/src/model/Account.h +++ b/src/model/Account.h @@ -30,6 +30,7 @@ public: wxString name; wxString number; bool shared; + bool blocked; bool _default; bool is_owner; }; diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 82968c1..f40fa4f 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -271,6 +271,7 @@ User* Database::LoadUser(const wxString& name) account.name = set.GetAsString(wxT("name")); account.number = set.GetAsString(wxT("number")); account.shared = set.GetBool(wxT("shared")); + account.blocked = set.GetBool(wxT("blocked")); account._default = set.GetBool(wxT("default_account")); account.is_owner = true; user->_accounts.push_back(account); @@ -287,6 +288,7 @@ User* Database::LoadUser(const wxString& name) account.name = set.GetAsString(wxT("name")); account.number = set.GetAsString(wxT("number")); account.shared = set.GetBool(wxT("shared")); + account.blocked = set.GetBool(wxT("blocked")); account._default = set.GetBool(wxT("default_account")); account.is_owner = false; user->_accounts.push_back(account); @@ -754,7 +756,7 @@ wxString Database::AddAccount(User* user, Account& ac) { wxString req; - req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'default_account') VALUES ('") ; + req = wxT("INSERT INTO account ('user', 'name', 'number', 'shared', 'blocked', 'default_account') VALUES ('") ; req += user->_id + wxT("'"); req += wxT(", '") + ac.name + wxT("'"); req += wxT(", '") + ac.number + wxT("'"); @@ -762,6 +764,10 @@ wxString Database::AddAccount(User* user, Account& ac) req += wxT(", '1'") ; else req += wxT(", '0'") ; + if (ac.blocked) + req += wxT(", '1'") ; + else + req += wxT(", '0'") ; if (ac._default) req += wxT(", '1'") ; else @@ -783,6 +789,10 @@ void Database::UpdateAccount(Account& ac) req += wxT(", shared='1'"); else req += wxT(", shared='0'"); + if (ac.blocked) + req += wxT(", blocked='1'"); + else + req += wxT(", blocked='0'"); if (ac._default) req += wxT(", default_account='1'"); else @@ -1389,7 +1399,7 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y std::map* categories) { wxSQLite3ResultSet set; - wxString req; + wxString req, req2; std::vector::iterator accountIt; std::vector::iterator categoryIt; @@ -1412,7 +1422,7 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y for (categoryIt = user->_categories.begin(); categoryIt != user->_categories.end(); categoryIt++) { - req = wxT("SELECT SUM(amount) as amount FROM operation WHERE category='") + categoryIt->id + wxT("'"); + req = wxT("SELECT SUM(amount) as amount FROM operation AS o1 WHERE category='") + categoryIt->id + wxT("'"); accountIt = user->_accounts.begin(); req += wxT(" AND (account IN('") + accountIt->id; accountIt++; @@ -1425,17 +1435,31 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y 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 (transfert='' OR transfert IS NULL)"); - req += wxT(" AND amount < 0"); req += wxT(" AND meta='0'"); - EXECUTE_SQL_QUERY(req, set, ); + req2 = req + wxT(" AND (transfert='' OR transfert IS NULL)"); + req2 += wxT(" AND amount < 0"); + + EXECUTE_SQL_QUERY(req2, set, ); if (set.NextRow()) { (*categories)[categoryIt->id] = -set.GetDouble(wxT("amount")); } set.Finalize(); + + // Transfert on blocked accounts must be computed + req2 = req + wxT(" AND transfert != ''"); + req2 = req + wxT(" AND (SELECT blocked FROM account WHERE id=o1.account)"); + req2 += wxT(" AND amount > 0"); + + EXECUTE_SQL_QUERY(req2, set, ); + + if (set.NextRow()) + { + (*categories)[categoryIt->id] += set.GetDouble(wxT("amount")); + } + set.Finalize(); } } } diff --git a/src/model/User.cpp b/src/model/User.cpp index df40721..359a486 100644 --- a/src/model/User.cpp +++ b/src/model/User.cpp @@ -102,6 +102,14 @@ const wxFont User::GetCategoryFont(wxString& catId) return f; } +Account User::GetAccount(const wxString& accountId) +{ + std::vector::iterator it; + for (it=_accounts.begin(); it !=_accounts.end(); it++) + if (it->id == accountId) + return *it; +} + wxString User::GetAccountName(const wxString& accountId) { std::vector::iterator it; diff --git a/src/model/User.h b/src/model/User.h index 257cb7a..3e9b689 100644 --- a/src/model/User.h +++ b/src/model/User.h @@ -51,6 +51,7 @@ public: wxString GetCategoryName(wxString& catId); wxString GetCategoryId(wxString& catName); const wxFont GetCategoryFont(wxString& catId); + Account GetAccount(const wxString& accountId); wxString GetAccountName(const wxString& accountId); wxString GetAccountId(wxString& accountName); int GetCategoriesNumber(); diff --git a/src/view/AccountPanel.cpp b/src/view/AccountPanel.cpp index 299bf34..4013554 100644 --- a/src/view/AccountPanel.cpp +++ b/src/view/AccountPanel.cpp @@ -149,7 +149,7 @@ AccountPanel::AccountPanel(KissCount* kiss, wxUI *parent) : wxScrolledWindow(&(* ChangeUser(); - //Fit(); + Fit(); SetMinSize(wxSize(rect.width-rect.x, rect.height-rect.y-128)); SetScrollbars(10, 10, 100/10, 100/10); @@ -237,7 +237,7 @@ void AccountPanel::ChangeUser() else _tree.AppendItem(rootNode, wxString::Format(wxT("%d"), it->first)); } - //Fit(); + Fit(); if (curYear != -1) { _tree.SelectItem(curNode, true); @@ -280,7 +280,7 @@ void AccountPanel::LoadYear(int year, bool showMonth) } _tree.Expand(parentNode); - //Fit(); + Fit(); if (showMonth) { _tree.SelectItem(curMonthNode, true); @@ -356,7 +356,7 @@ void AccountPanel::ShowMonth(int month, int year) UpdateStats(); - //Fit(); + Fit(); // SetMinSize(GetSize()); } @@ -412,7 +412,8 @@ void AccountPanel::UpdateStats() unsigned int day; bool checkMode = _checkCheckMode->IsChecked(); std::map* notChecked = NULL; - + Account account; + Operation op; curCredit = curDebit = totalCredit = totalDebit = percents = 0.0; @@ -436,35 +437,49 @@ void AccountPanel::UpdateStats() { if (it->meta) continue; - if (it->amount > 0) + op = *it; + + // A credit on a blocked account must be considered as a debit + if (op.transfert.Length() && op.amount > 0) { - if (day >= it->day) + account = user->GetAccount(op.account); + + if (account.blocked) { - if (!it->transfert.Length()) - curCredit += it->amount; - if (!checkMode || (checkMode && it->checked)) - curAccountAmount[it->account] += it->amount; + op.amount = -op.amount; + op.transfert = wxT(""); } - if (!it->transfert.Length()) - totalCredit += it->amount; - if (!checkMode || (checkMode && it->checked)) - finalAccountAmount[it->account] += it->amount; + } + + if (op.amount >= 0) + { + if (day >= op.day) + { + if (!op.transfert.Length()) + curCredit += op.amount; + if (!checkMode || (checkMode && op.checked)) + curAccountAmount[op.account] += op.amount; + } + if (!op.transfert.Length()) + totalCredit += op.amount; + if (!checkMode || (checkMode && op.checked)) + finalAccountAmount[op.account] += op.amount; } else { - if (!it->transfert.Length()) - _categoriesValues[_categoriesIndexes[user->GetCategoryName(it->category)]] += -it->amount ; - if (day >= it->day) + if (!op.transfert.Length()) + _categoriesValues[_categoriesIndexes[user->GetCategoryName(op.category)]] += -op.amount ; + if (day >= op.day) { - if (!it->transfert.Length()) - curDebit += -it->amount; - if (!checkMode || (checkMode && it->checked)) - curAccountAmount[it->account] += it->amount; + if (!op.transfert.Length()) + curDebit += -op.amount; + if (!checkMode || (checkMode && op.checked)) + curAccountAmount[op.account] += op.amount; } - if (!it->transfert.Length()) - totalDebit += -it->amount; - if (!checkMode || (checkMode && it->checked)) - finalAccountAmount[it->account] += it->amount; + if (!op.transfert.Length()) + totalDebit += -op.amount; + if (!checkMode || (checkMode && op.checked)) + finalAccountAmount[op.account] += op.amount; } } @@ -623,6 +638,7 @@ void AccountPanel::OnTreeChange(wxTreeEvent& event) } inModification = false; + Fit(); } void AccountPanel::GetTreeSelection(int* month, int* year) @@ -682,6 +698,8 @@ void AccountPanel::OnMenuGenerate(wxCommandEvent& event) GenerateDialog g(_kiss, _wxUI, month, year); g.ShowModal(); + + Fit(); } void AccountPanel::OnMenuDelete(wxCommandEvent& event) @@ -736,6 +754,8 @@ void AccountPanel::OnMenuDelete(wxCommandEvent& event) month = ops[year][0]; ShowMonth(month, year); } + + Fit(); } void AccountPanel::GenerateMonth(int month, int year) @@ -808,6 +828,8 @@ void AccountPanel::GenerateMonth(int month, int year) _tree.SelectItem(node, true); ShowMonth(month, year); + + Fit(); } void AccountPanel::OnShow(wxShowEvent& event) @@ -816,6 +838,7 @@ void AccountPanel::OnShow(wxShowEvent& event) _wxUI->SetTitle(_kiss->GetUser()->_name + wxT(" - ") + months[_curMonth] + wxT(" ") + wxString::Format(wxT("%d"), _curYear)); else _wxUI->SetTitle(_kiss->GetUser()->_name); + Fit(); } void AccountPanel::OnCalendarChange(wxCalendarEvent& event) diff --git a/src/view/PreferencesPanel.cpp b/src/view/PreferencesPanel.cpp index ae7da1f..6f85fdf 100644 --- a/src/view/PreferencesPanel.cpp +++ b/src/view/PreferencesPanel.cpp @@ -19,7 +19,7 @@ #include "PreferencesPanel.h" -enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT}; +enum {ACCOUNT_NAME, ACCOUNT_NUMBER, ACCOUNT_DEFAULT, ACCOUNT_BLOCKED, ACCOUNT_DELETE, NUMBER_COLS_ACCOUNT}; enum {CATEGORY_NAME, CATEGORY_BACKGROUND_COLOR, CATEGORY_FOREGROUND_COLOR, CATEGORY_FONT, CATEGORY_DELETE, NUMBER_COLS_CATEGORY}; enum {CATEGORIES_GRID_ID=1, ACCOUNTS_GRID_ID, NAME_ID, CHANGE_NAME_ID, CHANGE_PASSWORD_ID, KILL_ME_ID, LANGUAGE_ID, @@ -184,6 +184,7 @@ void PreferencesPanel::InitAccounts(User* user) _accountsGrid->SetColLabelValue(ACCOUNT_NAME, _("Name")); _accountsGrid->SetColLabelValue(ACCOUNT_NUMBER, _("Number")); _accountsGrid->SetColLabelValue(ACCOUNT_DEFAULT, _("Default")); + _accountsGrid->SetColLabelValue(ACCOUNT_BLOCKED, _("Blocked")); _accountsGrid->SetColLabelValue(ACCOUNT_DELETE, _("Delete")); _accountsGrid->SetDefaultCellFont(font); @@ -200,11 +201,15 @@ void PreferencesPanel::InitAccounts(User* user) _accountsGrid->SetCellEditor(curLine, ACCOUNT_NUMBER, new wxGridCellStarEditor ()); _accountsGrid->SetCellRenderer(curLine, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(curLine, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ()); + _accountsGrid->SetCellRenderer(curLine, ACCOUNT_BLOCKED, new wxGridCellBoolRenderer ()); + _accountsGrid->SetCellEditor(curLine, ACCOUNT_BLOCKED, new wxGridCellFastBoolEditor ()); _accountsGrid->SetCellRenderer(curLine, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(curLine, ACCOUNT_DELETE, new wxGridCellBoolEditor ()); _accountsGrid->SetCellValue(curLine, ACCOUNT_DEFAULT, (it->_default)?wxT("1"):wxT("0")); - - _accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); + _accountsGrid->SetCellValue(curLine, ACCOUNT_BLOCKED, (it->blocked)?wxT("1"):wxT("0")); + + _accountsGrid->SetCellAlignment(curLine, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); + _accountsGrid->SetCellAlignment(curLine, ACCOUNT_BLOCKED, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(curLine, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); if (!it->is_owner) @@ -212,6 +217,7 @@ void PreferencesPanel::InitAccounts(User* user) _accountsGrid->SetReadOnly(curLine, ACCOUNT_NAME, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_NUMBER, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true); + _accountsGrid->SetReadOnly(curLine, ACCOUNT_BLOCKED, true); } } @@ -219,6 +225,7 @@ void PreferencesPanel::InitAccounts(User* user) _accountsGrid->AppendRows(); _accountsGrid->SetReadOnly(curLine, ACCOUNT_DEFAULT, true); + _accountsGrid->SetReadOnly(curLine, ACCOUNT_BLOCKED, true); _accountsGrid->SetReadOnly(curLine, ACCOUNT_DELETE, true); } @@ -349,6 +356,12 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) else new_account._default = false; + value = _accountsGrid->GetCellValue(row, ACCOUNT_BLOCKED); + if (value.Length() && value != wxT("0")) + new_account.blocked = true; + else + new_account.blocked = false; + if (col == ACCOUNT_DEFAULT) { new_account.id = user->_accounts[row].id; @@ -375,6 +388,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) if (user->GetAccountsNumber() && row < user->GetAccountsNumber()) { new_account.id = user->_accounts[row].id; + new_account.shared = user->_accounts[row].shared; if (col == ACCOUNT_DELETE) { @@ -427,14 +441,21 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) return ; } + new_account.shared = false; + new_account.blocked = false; + _accountsGrid->SetCellRenderer(row, ACCOUNT_DEFAULT, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(row, ACCOUNT_DEFAULT, new wxGridCellFastBoolEditor ()); + _accountsGrid->SetCellRenderer(row, ACCOUNT_BLOCKED, new wxGridCellBoolRenderer ()); + _accountsGrid->SetCellEditor(row, ACCOUNT_BLOCKED, new wxGridCellFastBoolEditor ()); _accountsGrid->SetCellRenderer(row, ACCOUNT_DELETE, new wxGridCellBoolRenderer ()); _accountsGrid->SetCellEditor(row, ACCOUNT_DELETE, new wxGridCellBoolEditor ()); _accountsGrid->SetCellAlignment(row, ACCOUNT_DEFAULT, wxALIGN_CENTRE, wxALIGN_CENTRE); + _accountsGrid->SetCellAlignment(row, ACCOUNT_BLOCKED, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetCellAlignment(row, ACCOUNT_DELETE, wxALIGN_CENTRE, wxALIGN_CENTRE); _accountsGrid->SetReadOnly(row, ACCOUNT_DEFAULT, false); + _accountsGrid->SetReadOnly(row, ACCOUNT_BLOCKED, false); _accountsGrid->SetReadOnly(row, ACCOUNT_DELETE, false); if (!user->GetAccountsNumber()) @@ -447,6 +468,7 @@ void PreferencesPanel::OnAccountModified(wxGridEvent& event) _accountsGrid->AppendRows(); _accountsGrid->SetReadOnly(row+1, ACCOUNT_DEFAULT, true); + _accountsGrid->SetReadOnly(row+1, ACCOUNT_BLOCKED, true); _accountsGrid->SetReadOnly(row+1, ACCOUNT_DELETE, true); _kiss->AddAccount(new_account); diff --git a/src/view/wxUI.cpp b/src/view/wxUI.cpp index 99d3f3f..965e0d7 100644 --- a/src/view/wxUI.cpp +++ b/src/view/wxUI.cpp @@ -256,6 +256,9 @@ void wxUI::ShowPanel(wxPanel* panel) panel = _statsPanel; } + _hbox->Detach(_accountPanel); + _accountPanel->Hide(); + _needReload = false; }