Add shared account management
This commit is contained in:
parent
d800f23029
commit
28c92d3b28
6
TODO
6
TODO
|
@ -8,7 +8,6 @@ Can type a letter with a comboboxes
|
|||
Windows version
|
||||
Need packaging
|
||||
Better build system for wxFreeChart (hacked by me)
|
||||
Shared accounts
|
||||
Documentation (en)
|
||||
|
||||
Cool for 0.1:
|
||||
|
@ -36,5 +35,6 @@ Undo/redo
|
|||
===============================================================
|
||||
BUGS
|
||||
|
||||
When we broke a transfert into a meta operation and re create it,
|
||||
it's not taken in account by UpdateStats
|
||||
* When we broke a transfert into a meta operation and re create it,
|
||||
it's not taken in account by UpdateStats
|
||||
|
||||
|
|
2
init.sql
2
init.sql
|
@ -1,7 +1,7 @@
|
|||
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 shared_account(id REFERENCES account(id), user REFERENCES user(id));
|
||||
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));
|
||||
CREATE TABLE category(id INTEGER PRIMARY KEY, user REFERENCES user(id), parent REFERENCES category(id), name VARCHAR(255), backcolor VARCHAR(10), forecolor VARCHAR(10), font VARCHAR(255));
|
||||
|
|
Binary file not shown.
|
@ -2,7 +2,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-10-14 20:46+0200\n"
|
||||
"POT-Creation-Date: 2010-10-24 16:03+0200\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Soutadé <soutade@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
|
@ -20,16 +20,16 @@ msgstr ""
|
|||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#: src/view/StatsPanel.cpp:282
|
||||
#: src/view/PreferencesPanel.cpp:660
|
||||
#: src/view/PreferencesPanel.cpp:743
|
||||
msgid " - "
|
||||
msgstr " - "
|
||||
|
||||
#: src/view/UsersDialog.cpp:118
|
||||
#: src/view/PreferencesPanel.cpp:384
|
||||
#: src/view/PreferencesPanel.cpp:403
|
||||
#: src/view/PreferencesPanel.cpp:553
|
||||
#: src/view/PreferencesPanel.cpp:572
|
||||
#: src/view/PreferencesPanel.cpp:618
|
||||
#: src/view/PreferencesPanel.cpp:404
|
||||
#: src/view/PreferencesPanel.cpp:423
|
||||
#: src/view/PreferencesPanel.cpp:636
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
#: src/view/PreferencesPanel.cpp:701
|
||||
msgid " already exists"
|
||||
msgstr " existe déjà "
|
||||
|
||||
|
@ -41,11 +41,11 @@ msgstr " entrées trouvées"
|
|||
msgid " not found, aborting"
|
||||
msgstr " non trouvé, arrêt"
|
||||
|
||||
#: src/view/AccountPanel.cpp:705
|
||||
#: src/view/AccountPanel.cpp:709
|
||||
msgid " operations ?"
|
||||
msgstr " opérations ?"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:667
|
||||
#: src/view/PreferencesPanel.cpp:750
|
||||
msgid " profil ?"
|
||||
msgstr " profil ?"
|
||||
|
||||
|
@ -66,8 +66,8 @@ msgstr "A propos"
|
|||
msgid "Account"
|
||||
msgstr "Compte"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:384
|
||||
#: src/view/PreferencesPanel.cpp:403
|
||||
#: src/view/PreferencesPanel.cpp:404
|
||||
#: src/view/PreferencesPanel.cpp:423
|
||||
msgid "Account "
|
||||
msgstr "Le compte "
|
||||
|
||||
|
@ -80,7 +80,7 @@ msgid "Account number"
|
|||
msgstr "Numéro de compte"
|
||||
|
||||
#: src/view/StatsPanel.cpp:247
|
||||
#: src/view/PreferencesPanel.cpp:55
|
||||
#: src/view/PreferencesPanel.cpp:59
|
||||
msgid "Accounts"
|
||||
msgstr "Comptes"
|
||||
|
||||
|
@ -92,22 +92,22 @@ msgstr "Montant min"
|
|||
msgid "Amount to"
|
||||
msgstr "Montant max"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:365
|
||||
#: src/view/PreferencesPanel.cpp:667
|
||||
#: src/view/AccountPanel.cpp:700
|
||||
#: src/view/PreferencesPanel.cpp:385
|
||||
#: src/view/PreferencesPanel.cpp:750
|
||||
#: src/view/AccountPanel.cpp:704
|
||||
msgid "Are you sure want to delete "
|
||||
msgstr "Etes vous sûr de vouloir supprimer "
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:534
|
||||
#: src/view/grid/GridAccount.cpp:743
|
||||
#: src/view/PreferencesPanel.cpp:617
|
||||
#: src/view/grid/GridAccount.cpp:745
|
||||
msgid "Are you sure want to delete : \n"
|
||||
msgstr "Etes vous sûr de vouloir supprimer : \n"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:280
|
||||
#: src/view/PreferencesPanel.cpp:306
|
||||
msgid "Ascending"
|
||||
msgstr "Croissant"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:221
|
||||
#: src/view/PreferencesPanel.cpp:247
|
||||
msgid "Background color"
|
||||
msgstr "Couleur d'arrière plan"
|
||||
|
||||
|
@ -117,17 +117,17 @@ msgstr "Couleur d'arrière plan"
|
|||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: src/view/grid/GridAccount.cpp:1067
|
||||
#: src/view/grid/GridAccount.cpp:1074
|
||||
#: src/view/grid/GridAccount.cpp:1129
|
||||
#: src/view/grid/GridAccount.cpp:1136
|
||||
msgid "Cannot group these operations"
|
||||
msgstr "Impossible de grouper ces opérations"
|
||||
|
||||
#: src/view/grid/GridAccount.cpp:1202
|
||||
#: src/view/grid/GridAccount.cpp:1208
|
||||
#: src/view/grid/GridAccount.cpp:1263
|
||||
#: src/view/grid/GridAccount.cpp:1269
|
||||
msgid "Cannot ungroup these operations"
|
||||
msgstr "Impossible de dégrouper ces opérations"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:56
|
||||
#: src/view/PreferencesPanel.cpp:60
|
||||
msgid "Categories"
|
||||
msgstr "Catégories"
|
||||
|
||||
|
@ -136,16 +136,16 @@ msgstr "Catégories"
|
|||
msgid "Category"
|
||||
msgstr "Catégorie"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:553
|
||||
#: src/view/PreferencesPanel.cpp:572
|
||||
#: src/view/PreferencesPanel.cpp:636
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
msgid "Category "
|
||||
msgstr "Catégorie"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:72
|
||||
#: src/view/PreferencesPanel.cpp:77
|
||||
msgid "Change Name"
|
||||
msgstr "Changer de nom"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:73
|
||||
#: src/view/PreferencesPanel.cpp:78
|
||||
msgid "Change Password"
|
||||
msgstr "Changer le mot de passe"
|
||||
|
||||
|
@ -202,17 +202,17 @@ msgstr "Date max"
|
|||
msgid "Debit"
|
||||
msgstr "Débit"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:166
|
||||
#: src/view/PreferencesPanel.cpp:186
|
||||
msgid "Default"
|
||||
msgstr "Défaut"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:167
|
||||
#: src/view/PreferencesPanel.cpp:224
|
||||
#: src/view/AccountPanel.cpp:559
|
||||
#: src/view/PreferencesPanel.cpp:187
|
||||
#: src/view/PreferencesPanel.cpp:250
|
||||
#: src/view/AccountPanel.cpp:563
|
||||
msgid "Delete"
|
||||
msgstr "Supprimer"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:281
|
||||
#: src/view/PreferencesPanel.cpp:307
|
||||
msgid "Descending"
|
||||
msgstr "Décroissant"
|
||||
|
||||
|
@ -227,21 +227,21 @@ msgstr "Description"
|
|||
#: src/view/SearchPanel.cpp:145
|
||||
#: src/view/SearchPanel.cpp:159
|
||||
#: src/view/SearchPanel.cpp:170
|
||||
#: src/view/PreferencesPanel.cpp:361
|
||||
#: src/view/PreferencesPanel.cpp:384
|
||||
#: src/view/PreferencesPanel.cpp:403
|
||||
#: src/view/PreferencesPanel.cpp:553
|
||||
#: src/view/PreferencesPanel.cpp:572
|
||||
#: src/view/PreferencesPanel.cpp:612
|
||||
#: src/view/PreferencesPanel.cpp:618
|
||||
#: src/view/PreferencesPanel.cpp:381
|
||||
#: src/view/PreferencesPanel.cpp:404
|
||||
#: src/view/PreferencesPanel.cpp:423
|
||||
#: src/view/PreferencesPanel.cpp:636
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
#: src/view/PreferencesPanel.cpp:695
|
||||
#: src/view/PreferencesPanel.cpp:701
|
||||
#: src/view/PasswordDialog.cpp:72
|
||||
#: src/view/PasswordDialog.cpp:78
|
||||
#: src/view/AccountPanel.cpp:696
|
||||
#: src/view/grid/GridAccount.cpp:1067
|
||||
#: src/view/grid/GridAccount.cpp:1074
|
||||
#: src/view/grid/GridAccount.cpp:1202
|
||||
#: src/view/grid/GridAccount.cpp:1208
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:68
|
||||
#: src/view/AccountPanel.cpp:700
|
||||
#: src/view/grid/GridAccount.cpp:1129
|
||||
#: src/view/grid/GridAccount.cpp:1136
|
||||
#: src/view/grid/GridAccount.cpp:1263
|
||||
#: src/view/grid/GridAccount.cpp:1269
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:69
|
||||
#: src/model/Database.cpp:38
|
||||
#: src/model/Database.cpp:55
|
||||
#: src/model/Database.cpp:95
|
||||
|
@ -262,16 +262,16 @@ msgid "Final value"
|
|||
msgstr "Valeur finale"
|
||||
|
||||
#: src/view/grid/GridAccount.cpp:300
|
||||
#: src/model/Database.cpp:312
|
||||
#: src/controller/KissCount.cpp:305
|
||||
#: src/model/Database.cpp:329
|
||||
#: src/controller/KissCount.cpp:335
|
||||
msgid "Fix"
|
||||
msgstr "Fixe"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:223
|
||||
#: src/view/PreferencesPanel.cpp:249
|
||||
msgid "Font"
|
||||
msgstr "Police"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:222
|
||||
#: src/view/PreferencesPanel.cpp:248
|
||||
msgid "Foreground color"
|
||||
msgstr "Couleur d'avant plan"
|
||||
|
||||
|
@ -284,11 +284,11 @@ msgid "From "
|
|||
msgstr "A partir de "
|
||||
|
||||
#: src/view/GenerateDialog.cpp:31
|
||||
#: src/view/AccountPanel.cpp:556
|
||||
#: src/view/AccountPanel.cpp:560
|
||||
msgid "Generate month"
|
||||
msgstr "Générer mois"
|
||||
|
||||
#: src/controller/KissCount.cpp:307
|
||||
#: src/controller/KissCount.cpp:337
|
||||
msgid "Groceries"
|
||||
msgstr "Courses"
|
||||
|
||||
|
@ -296,7 +296,7 @@ msgstr "Courses"
|
|||
msgid "Group"
|
||||
msgstr "Grouper"
|
||||
|
||||
#: src/controller/KissCount.cpp:309
|
||||
#: src/controller/KissCount.cpp:339
|
||||
msgid "Hobbies"
|
||||
msgstr "Loisirs"
|
||||
|
||||
|
@ -320,11 +320,11 @@ msgstr "Montant max invalide"
|
|||
msgid "Invalid date range"
|
||||
msgstr "Intervalle de temps invalide"
|
||||
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:68
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:69
|
||||
msgid "Invalid formula !"
|
||||
msgstr "Formule invalide !"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:612
|
||||
#: src/view/PreferencesPanel.cpp:695
|
||||
msgid "Invalid name"
|
||||
msgstr "Nom invalide"
|
||||
|
||||
|
@ -340,43 +340,43 @@ msgstr "Mot de passe invalide"
|
|||
msgid "Invalide date range"
|
||||
msgstr "Intervalle de temps invalide"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:361
|
||||
#: src/view/PreferencesPanel.cpp:381
|
||||
msgid "It must be at least one account !"
|
||||
msgstr "Il doit y avoir au moins un compte !"
|
||||
|
||||
#: src/view/AccountPanel.cpp:696
|
||||
#: src/view/AccountPanel.cpp:700
|
||||
msgid "It must be at least one month !"
|
||||
msgstr "Il doit rester au mois un mois"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:74
|
||||
#: src/view/PreferencesPanel.cpp:79
|
||||
msgid "Kill me"
|
||||
msgstr "Kill me"
|
||||
|
||||
#: src/view/StatsPanel.cpp:302
|
||||
#: src/view/PreferencesPanel.cpp:652
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
#: src/view/PreferencesPanel.cpp:735
|
||||
#: src/view/PreferencesPanel.cpp:738
|
||||
msgid "KissCount"
|
||||
msgstr "KissCount"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:57
|
||||
#: src/view/PreferencesPanel.cpp:61
|
||||
msgid "Language"
|
||||
msgstr "Langue"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
#: src/view/PreferencesPanel.cpp:738
|
||||
msgid "Language not changed"
|
||||
msgstr "Langue non changée"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:652
|
||||
#: src/view/PreferencesPanel.cpp:735
|
||||
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:66
|
||||
#: src/view/PreferencesPanel.cpp:163
|
||||
#: src/view/PreferencesPanel.cpp:220
|
||||
#: src/view/PreferencesPanel.cpp:71
|
||||
#: src/view/PreferencesPanel.cpp:184
|
||||
#: src/view/PreferencesPanel.cpp:246
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:624
|
||||
#: src/view/PreferencesPanel.cpp:707
|
||||
msgid "Name changed"
|
||||
msgstr "Nom changé"
|
||||
|
||||
|
@ -401,7 +401,7 @@ msgstr ""
|
|||
msgid "No entry found"
|
||||
msgstr "Pas d'entrée trouvée"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:164
|
||||
#: src/view/PreferencesPanel.cpp:185
|
||||
msgid "Number"
|
||||
msgstr "Numéro de compte"
|
||||
|
||||
|
@ -415,11 +415,11 @@ msgstr "OK"
|
|||
msgid "Old password "
|
||||
msgstr "Ancien mot de passe"
|
||||
|
||||
#: src/controller/KissCount.cpp:311
|
||||
#: src/controller/KissCount.cpp:341
|
||||
msgid "Operating exepense"
|
||||
msgstr "Frais de fonctionnement"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:58
|
||||
#: src/view/PreferencesPanel.cpp:62
|
||||
msgid "Operation order"
|
||||
msgstr "Ordre des opérations"
|
||||
|
||||
|
@ -427,7 +427,7 @@ msgstr "Ordre des opérations"
|
|||
msgid "Operations"
|
||||
msgstr "Opérations"
|
||||
|
||||
#: src/controller/KissCount.cpp:315
|
||||
#: src/controller/KissCount.cpp:345
|
||||
msgid "Other"
|
||||
msgstr "Autres"
|
||||
|
||||
|
@ -453,8 +453,8 @@ msgstr ""
|
|||
msgid "Please retype new password"
|
||||
msgstr "Re entrez le mot de passe"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:626
|
||||
#: src/view/PreferencesPanel.cpp:660
|
||||
#: src/view/PreferencesPanel.cpp:709
|
||||
#: src/view/PreferencesPanel.cpp:743
|
||||
#: src/view/ButtonPanel.cpp:72
|
||||
msgid "Preferences"
|
||||
msgstr "Préférences"
|
||||
|
@ -486,9 +486,9 @@ msgstr "Chercher"
|
|||
msgid "Serie 1"
|
||||
msgstr "Série 1"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:165
|
||||
msgid "Shared"
|
||||
msgstr "Partagé"
|
||||
#: src/view/PreferencesPanel.cpp:63
|
||||
msgid "Shared with"
|
||||
msgstr "Partagé avec"
|
||||
|
||||
#: src/view/StatsPanel.cpp:282
|
||||
#: src/view/ButtonPanel.cpp:70
|
||||
|
@ -522,13 +522,13 @@ msgstr "Dégrouper"
|
|||
msgid "Unable to open Database"
|
||||
msgstr "Impossible d'ouvrir la base de données"
|
||||
|
||||
#: src/controller/KissCount.cpp:313
|
||||
#: src/controller/KissCount.cpp:343
|
||||
msgid "Unexpected"
|
||||
msgstr "Exceptionnel"
|
||||
|
||||
#: src/model/User.cpp:46
|
||||
#: src/model/User.cpp:61
|
||||
#: src/model/User.cpp:92
|
||||
#: src/model/User.cpp:52
|
||||
#: src/model/User.cpp:72
|
||||
#: src/model/User.cpp:112
|
||||
msgid "Unknown"
|
||||
msgstr "Inconnu"
|
||||
|
||||
|
@ -536,13 +536,13 @@ msgstr "Inconnu"
|
|||
msgid "Update failed !\n"
|
||||
msgstr "La mise à jour à échouée !\n"
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:54
|
||||
#: src/view/PreferencesPanel.cpp:58
|
||||
msgid "User"
|
||||
msgstr "Utilisateur"
|
||||
|
||||
#: src/view/UsersDialog.cpp:38
|
||||
#: src/view/UsersDialog.cpp:118
|
||||
#: src/view/PreferencesPanel.cpp:618
|
||||
#: src/view/PreferencesPanel.cpp:701
|
||||
msgid "User "
|
||||
msgstr "Utilisateur"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-10-14 20:46+0200\n"
|
||||
"POT-Creation-Date: 2010-10-24 16:03+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -17,13 +17,13 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: src/view/StatsPanel.cpp:282 src/view/PreferencesPanel.cpp:660
|
||||
#: src/view/StatsPanel.cpp:282 src/view/PreferencesPanel.cpp:743
|
||||
msgid " - "
|
||||
msgstr ""
|
||||
|
||||
#: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:384
|
||||
#: src/view/PreferencesPanel.cpp:403 src/view/PreferencesPanel.cpp:553
|
||||
#: src/view/PreferencesPanel.cpp:572 src/view/PreferencesPanel.cpp:618
|
||||
#: src/view/UsersDialog.cpp:118 src/view/PreferencesPanel.cpp:404
|
||||
#: src/view/PreferencesPanel.cpp:423 src/view/PreferencesPanel.cpp:636
|
||||
#: src/view/PreferencesPanel.cpp:655 src/view/PreferencesPanel.cpp:701
|
||||
msgid " already exists"
|
||||
msgstr ""
|
||||
|
||||
|
@ -35,11 +35,11 @@ msgstr ""
|
|||
msgid " not found, aborting"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/AccountPanel.cpp:705
|
||||
#: src/view/AccountPanel.cpp:709
|
||||
msgid " operations ?"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:667
|
||||
#: src/view/PreferencesPanel.cpp:750
|
||||
msgid " profil ?"
|
||||
msgstr ""
|
||||
|
||||
|
@ -59,7 +59,7 @@ msgstr ""
|
|||
msgid "Account"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:384 src/view/PreferencesPanel.cpp:403
|
||||
#: src/view/PreferencesPanel.cpp:404 src/view/PreferencesPanel.cpp:423
|
||||
msgid "Account "
|
||||
msgstr ""
|
||||
|
||||
|
@ -71,7 +71,7 @@ msgstr ""
|
|||
msgid "Account number"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/StatsPanel.cpp:247 src/view/PreferencesPanel.cpp:55
|
||||
#: src/view/StatsPanel.cpp:247 src/view/PreferencesPanel.cpp:59
|
||||
msgid "Accounts"
|
||||
msgstr ""
|
||||
|
||||
|
@ -83,20 +83,20 @@ msgstr ""
|
|||
msgid "Amount to"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:365 src/view/PreferencesPanel.cpp:667
|
||||
#: src/view/AccountPanel.cpp:700
|
||||
#: src/view/PreferencesPanel.cpp:385 src/view/PreferencesPanel.cpp:750
|
||||
#: src/view/AccountPanel.cpp:704
|
||||
msgid "Are you sure want to delete "
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:534 src/view/grid/GridAccount.cpp:743
|
||||
#: src/view/PreferencesPanel.cpp:617 src/view/grid/GridAccount.cpp:745
|
||||
msgid "Are you sure want to delete : \n"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:280
|
||||
#: src/view/PreferencesPanel.cpp:306
|
||||
msgid "Ascending"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:221
|
||||
#: src/view/PreferencesPanel.cpp:247
|
||||
msgid "Background color"
|
||||
msgstr ""
|
||||
|
||||
|
@ -105,15 +105,15 @@ msgstr ""
|
|||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/grid/GridAccount.cpp:1067 src/view/grid/GridAccount.cpp:1074
|
||||
#: src/view/grid/GridAccount.cpp:1129 src/view/grid/GridAccount.cpp:1136
|
||||
msgid "Cannot group these operations"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/grid/GridAccount.cpp:1202 src/view/grid/GridAccount.cpp:1208
|
||||
#: src/view/grid/GridAccount.cpp:1263 src/view/grid/GridAccount.cpp:1269
|
||||
msgid "Cannot ungroup these operations"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:56
|
||||
#: src/view/PreferencesPanel.cpp:60
|
||||
msgid "Categories"
|
||||
msgstr ""
|
||||
|
||||
|
@ -121,15 +121,15 @@ msgstr ""
|
|||
msgid "Category"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:553 src/view/PreferencesPanel.cpp:572
|
||||
#: src/view/PreferencesPanel.cpp:636 src/view/PreferencesPanel.cpp:655
|
||||
msgid "Category "
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:72
|
||||
#: src/view/PreferencesPanel.cpp:77
|
||||
msgid "Change Name"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:73
|
||||
#: src/view/PreferencesPanel.cpp:78
|
||||
msgid "Change Password"
|
||||
msgstr ""
|
||||
|
||||
|
@ -185,16 +185,16 @@ msgstr ""
|
|||
msgid "Debit"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:166
|
||||
#: src/view/PreferencesPanel.cpp:186
|
||||
msgid "Default"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:167 src/view/PreferencesPanel.cpp:224
|
||||
#: src/view/AccountPanel.cpp:559
|
||||
#: src/view/PreferencesPanel.cpp:187 src/view/PreferencesPanel.cpp:250
|
||||
#: src/view/AccountPanel.cpp:563
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:281
|
||||
#: src/view/PreferencesPanel.cpp:307
|
||||
msgid "Descending"
|
||||
msgstr ""
|
||||
|
||||
|
@ -205,14 +205,14 @@ msgstr ""
|
|||
#: src/view/UsersDialog.cpp:88 src/view/UsersDialog.cpp:118
|
||||
#: src/view/SearchPanel.cpp:135 src/view/SearchPanel.cpp:145
|
||||
#: src/view/SearchPanel.cpp:159 src/view/SearchPanel.cpp:170
|
||||
#: src/view/PreferencesPanel.cpp:361 src/view/PreferencesPanel.cpp:384
|
||||
#: src/view/PreferencesPanel.cpp:403 src/view/PreferencesPanel.cpp:553
|
||||
#: src/view/PreferencesPanel.cpp:572 src/view/PreferencesPanel.cpp:612
|
||||
#: src/view/PreferencesPanel.cpp:618 src/view/PasswordDialog.cpp:72
|
||||
#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:696
|
||||
#: src/view/grid/GridAccount.cpp:1067 src/view/grid/GridAccount.cpp:1074
|
||||
#: src/view/grid/GridAccount.cpp:1202 src/view/grid/GridAccount.cpp:1208
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:68 src/model/Database.cpp:38
|
||||
#: src/view/PreferencesPanel.cpp:381 src/view/PreferencesPanel.cpp:404
|
||||
#: src/view/PreferencesPanel.cpp:423 src/view/PreferencesPanel.cpp:636
|
||||
#: src/view/PreferencesPanel.cpp:655 src/view/PreferencesPanel.cpp:695
|
||||
#: src/view/PreferencesPanel.cpp:701 src/view/PasswordDialog.cpp:72
|
||||
#: src/view/PasswordDialog.cpp:78 src/view/AccountPanel.cpp:700
|
||||
#: src/view/grid/GridAccount.cpp:1129 src/view/grid/GridAccount.cpp:1136
|
||||
#: src/view/grid/GridAccount.cpp:1263 src/view/grid/GridAccount.cpp:1269
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:69 src/model/Database.cpp:38
|
||||
#: src/model/Database.cpp:55 src/model/Database.cpp:95
|
||||
#: src/model/Database.cpp:102 src/model/Database.cpp:120
|
||||
#: src/model/Database.cpp:147 src/model/Database.cpp:155
|
||||
|
@ -228,16 +228,16 @@ msgstr ""
|
|||
msgid "Final value"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/grid/GridAccount.cpp:300 src/model/Database.cpp:312
|
||||
#: src/controller/KissCount.cpp:305
|
||||
#: src/view/grid/GridAccount.cpp:300 src/model/Database.cpp:329
|
||||
#: src/controller/KissCount.cpp:335
|
||||
msgid "Fix"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:223
|
||||
#: src/view/PreferencesPanel.cpp:249
|
||||
msgid "Font"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:222
|
||||
#: src/view/PreferencesPanel.cpp:248
|
||||
msgid "Foreground color"
|
||||
msgstr ""
|
||||
|
||||
|
@ -249,11 +249,11 @@ msgstr ""
|
|||
msgid "From "
|
||||
msgstr ""
|
||||
|
||||
#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:556
|
||||
#: src/view/GenerateDialog.cpp:31 src/view/AccountPanel.cpp:560
|
||||
msgid "Generate month"
|
||||
msgstr ""
|
||||
|
||||
#: src/controller/KissCount.cpp:307
|
||||
#: src/controller/KissCount.cpp:337
|
||||
msgid "Groceries"
|
||||
msgstr ""
|
||||
|
||||
|
@ -261,7 +261,7 @@ msgstr ""
|
|||
msgid "Group"
|
||||
msgstr ""
|
||||
|
||||
#: src/controller/KissCount.cpp:309
|
||||
#: src/controller/KissCount.cpp:339
|
||||
msgid "Hobbies"
|
||||
msgstr ""
|
||||
|
||||
|
@ -285,11 +285,11 @@ msgstr ""
|
|||
msgid "Invalid date range"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:68
|
||||
#: src/view/grid/wxGridCellFormulaEditor.cpp:69
|
||||
msgid "Invalid formula !"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:612
|
||||
#: src/view/PreferencesPanel.cpp:695
|
||||
msgid "Invalid name"
|
||||
msgstr ""
|
||||
|
||||
|
@ -305,41 +305,41 @@ msgstr ""
|
|||
msgid "Invalide date range"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:361
|
||||
#: src/view/PreferencesPanel.cpp:381
|
||||
msgid "It must be at least one account !"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/AccountPanel.cpp:696
|
||||
#: src/view/AccountPanel.cpp:700
|
||||
msgid "It must be at least one month !"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:74
|
||||
#: src/view/PreferencesPanel.cpp:79
|
||||
msgid "Kill me"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/StatsPanel.cpp:302 src/view/PreferencesPanel.cpp:652
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
#: src/view/StatsPanel.cpp:302 src/view/PreferencesPanel.cpp:735
|
||||
#: src/view/PreferencesPanel.cpp:738
|
||||
msgid "KissCount"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:57
|
||||
#: src/view/PreferencesPanel.cpp:61
|
||||
msgid "Language"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:655
|
||||
#: src/view/PreferencesPanel.cpp:738
|
||||
msgid "Language not changed"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:652
|
||||
#: src/view/PreferencesPanel.cpp:735
|
||||
msgid "Language successfully changed, please go to another panel"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:66 src/view/PreferencesPanel.cpp:163
|
||||
#: src/view/PreferencesPanel.cpp:220
|
||||
#: src/view/PreferencesPanel.cpp:71 src/view/PreferencesPanel.cpp:184
|
||||
#: src/view/PreferencesPanel.cpp:246
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:624
|
||||
#: src/view/PreferencesPanel.cpp:707
|
||||
msgid "Name changed"
|
||||
msgstr ""
|
||||
|
||||
|
@ -361,7 +361,7 @@ msgstr ""
|
|||
msgid "No entry found"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:164
|
||||
#: src/view/PreferencesPanel.cpp:185
|
||||
msgid "Number"
|
||||
msgstr ""
|
||||
|
||||
|
@ -374,11 +374,11 @@ msgstr ""
|
|||
msgid "Old password "
|
||||
msgstr ""
|
||||
|
||||
#: src/controller/KissCount.cpp:311
|
||||
#: src/controller/KissCount.cpp:341
|
||||
msgid "Operating exepense"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:58
|
||||
#: src/view/PreferencesPanel.cpp:62
|
||||
msgid "Operation order"
|
||||
msgstr ""
|
||||
|
||||
|
@ -386,7 +386,7 @@ msgstr ""
|
|||
msgid "Operations"
|
||||
msgstr ""
|
||||
|
||||
#: src/controller/KissCount.cpp:315
|
||||
#: src/controller/KissCount.cpp:345
|
||||
msgid "Other"
|
||||
msgstr ""
|
||||
|
||||
|
@ -409,7 +409,7 @@ msgstr ""
|
|||
msgid "Please retype new password"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:626 src/view/PreferencesPanel.cpp:660
|
||||
#: src/view/PreferencesPanel.cpp:709 src/view/PreferencesPanel.cpp:743
|
||||
#: src/view/ButtonPanel.cpp:72
|
||||
msgid "Preferences"
|
||||
msgstr ""
|
||||
|
@ -439,8 +439,8 @@ msgstr ""
|
|||
msgid "Serie 1"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:165
|
||||
msgid "Shared"
|
||||
#: src/view/PreferencesPanel.cpp:63
|
||||
msgid "Shared with"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/StatsPanel.cpp:282 src/view/ButtonPanel.cpp:70
|
||||
|
@ -472,11 +472,11 @@ msgstr ""
|
|||
msgid "Unable to open Database"
|
||||
msgstr ""
|
||||
|
||||
#: src/controller/KissCount.cpp:313
|
||||
#: src/controller/KissCount.cpp:343
|
||||
msgid "Unexpected"
|
||||
msgstr ""
|
||||
|
||||
#: src/model/User.cpp:46 src/model/User.cpp:61 src/model/User.cpp:92
|
||||
#: src/model/User.cpp:52 src/model/User.cpp:72 src/model/User.cpp:112
|
||||
msgid "Unknown"
|
||||
msgstr ""
|
||||
|
||||
|
@ -484,12 +484,12 @@ msgstr ""
|
|||
msgid "Update failed !\n"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/PreferencesPanel.cpp:54
|
||||
#: src/view/PreferencesPanel.cpp:58
|
||||
msgid "User"
|
||||
msgstr ""
|
||||
|
||||
#: src/view/UsersDialog.cpp:38 src/view/UsersDialog.cpp:118
|
||||
#: src/view/PreferencesPanel.cpp:618
|
||||
#: src/view/PreferencesPanel.cpp:701
|
||||
msgid "User "
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -138,6 +138,16 @@ void KissCount::DeleteOperations(int month, int year)
|
|||
}
|
||||
}
|
||||
|
||||
double KissCount::MetaAmount(const wxString& id)
|
||||
{
|
||||
return _db->MetaAmount(id);
|
||||
}
|
||||
|
||||
double KissCount::MetaPositiveAmount(const wxString& id)
|
||||
{
|
||||
return _db->MetaPositiveAmount(id);
|
||||
}
|
||||
|
||||
void KissCount::SetAccountAmount(int month, int year, const wxString& accountId, double amount)
|
||||
{
|
||||
_db->SetAccountAmount(month, year, accountId, amount);
|
||||
|
@ -181,6 +191,21 @@ void KissCount::AddSharedAccount(Account& ac, const wxString& granted)
|
|||
_db->AddSharedAccount(ac, granted);
|
||||
}
|
||||
|
||||
void KissCount::RemoveSharedAccount(Account& ac, const wxString& granted)
|
||||
{
|
||||
_db->RemoveSharedAccount(ac, granted);
|
||||
}
|
||||
|
||||
std::map<wxString, wxString> KissCount::getSharedAccountOwners(const wxString& account)
|
||||
{
|
||||
return _db->getSharedAccountOwners(account);
|
||||
}
|
||||
|
||||
wxString KissCount::getSharedAccountOwner(const wxString& account)
|
||||
{
|
||||
return _db->getSharedAccountOwner(account);
|
||||
}
|
||||
|
||||
wxString KissCount::AddCategory(Category& category)
|
||||
{
|
||||
wxString id;
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
void UpdateOperation(Operation& op);
|
||||
void DeleteOperation(Operation& op);
|
||||
void DeleteOperations(int month, int year);
|
||||
double MetaAmount(const wxString& id);
|
||||
double MetaPositiveAmount(const wxString& id);
|
||||
|
||||
double GetAccountAmount(const wxString& id, int month, int year);
|
||||
void SetAccountAmount(int month, int year, const wxString& accountId, double value);
|
||||
|
@ -62,6 +64,9 @@ public:
|
|||
void UpdateAccount(Account& ac);
|
||||
void DeleteAccount(Account& ac);
|
||||
void AddSharedAccount(Account& ac, const wxString& granted);
|
||||
void RemoveSharedAccount(Account& ac, const wxString& granted);
|
||||
std::map<wxString, wxString> getSharedAccountOwners(const wxString& account);
|
||||
wxString getSharedAccountOwner(const wxString& account);
|
||||
|
||||
wxString AddCategory(Category& category);
|
||||
void UpdateCategory(Category& category);
|
||||
|
@ -87,8 +92,8 @@ public:
|
|||
|
||||
std::map<wxString, double>* GetNotChecked(int month, int year);
|
||||
|
||||
wxFont ExtractFont(wxString strFont);
|
||||
wxString CompactFont(const wxFont& font);
|
||||
static wxFont ExtractFont(wxString strFont);
|
||||
static wxString CompactFont(const wxFont& font);
|
||||
|
||||
private:
|
||||
wxUI* _wxUI;
|
||||
|
|
|
@ -211,7 +211,7 @@ std::list<wxString> Database::GetUsers()
|
|||
|
||||
while (set.NextRow())
|
||||
{
|
||||
res.push_front(set.GetAsString(0));
|
||||
res.push_back(set.GetAsString(0));
|
||||
}
|
||||
set.Finalize();
|
||||
|
||||
|
@ -251,7 +251,7 @@ User* Database::LoadUser(const wxString& name)
|
|||
if (!set.NextRow())
|
||||
return NULL;
|
||||
|
||||
user = new User();
|
||||
user = new User(this);
|
||||
|
||||
user->_id = set.GetAsString(wxT("id"));
|
||||
user->_name = set.GetAsString(wxT("name"));
|
||||
|
@ -277,7 +277,7 @@ User* Database::LoadUser(const wxString& name)
|
|||
}
|
||||
set.Finalize();
|
||||
|
||||
req = wxT("SELECT * FROM account WHERE id IN (SELECT id FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY name ASC");
|
||||
req = wxT("SELECT * FROM account WHERE id IN (SELECT account FROM shared_account WHERE user='") + user->_id + wxT("') ORDER BY name ASC");
|
||||
|
||||
EXECUTE_SQL_QUERY_WITH_CODE(req, set, NULL, {delete user;}, {delete user;});
|
||||
|
||||
|
@ -621,7 +621,103 @@ void Database::DeleteOperations(User* user, int month, int year)
|
|||
req += wxT(" AND month='") + wxString::Format(wxT("%d"), month) + wxT("'");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
}
|
||||
|
||||
bool Database::LoadOperation(User* user, const wxString& id)
|
||||
{
|
||||
wxSQLite3ResultSet set;
|
||||
wxString req;
|
||||
bool ret = false;
|
||||
std::vector<Operation>::iterator it;
|
||||
|
||||
req = wxT("SELECT * FROM operation WHERE id='") + id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, false);
|
||||
|
||||
if (set.NextRow())
|
||||
{
|
||||
Operation op;
|
||||
op.id = set.GetAsString(wxT("id"));
|
||||
op.parent = set.GetAsString(wxT("parent"));
|
||||
op.account = set.GetAsString(wxT("account"));
|
||||
op.day = set.GetInt(wxT("day"));
|
||||
op.month = set.GetInt(wxT("month"));
|
||||
op.year = set.GetInt(wxT("year"));
|
||||
op.amount = set.GetDouble(wxT("amount"));
|
||||
op.description = set.GetAsString(wxT("description"));
|
||||
op.category = set.GetAsString(wxT("category"));
|
||||
op.fix_cost = set.GetBool(wxT("fix_cost"));
|
||||
op.checked = set.GetBool(wxT("checked"));
|
||||
op.transfert = set.GetAsString(wxT("transfert"));
|
||||
op.formula = set.GetAsString(wxT("formula"));
|
||||
op.meta = set.GetBool(wxT("meta"));
|
||||
for (it = (*user->_operations[op.year])[op.month].begin();
|
||||
it != (*user->_operations[op.year])[op.month].end();
|
||||
it++)
|
||||
{
|
||||
if (!op.fix_cost && it->fix_cost) continue;
|
||||
if (op.fix_cost && !it->fix_cost)
|
||||
{
|
||||
it--;
|
||||
break;
|
||||
}
|
||||
if (it->day > op.day)
|
||||
{
|
||||
it--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (it == (*user->_operations[op.year])[op.month].end())
|
||||
(*user->_operations[op.year])[op.month].push_back(op);
|
||||
else
|
||||
(*user->_operations[op.year])[op.month].insert(it, op);
|
||||
// if (op.fix_cost)
|
||||
// else
|
||||
// (*user->_operations[op.year])[op.month].push_back(op);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
set.Finalize();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// We may not have access to all operations if we have a shared account
|
||||
double Database::MetaAmount(const wxString& id)
|
||||
{
|
||||
wxSQLite3ResultSet set;
|
||||
wxString req;
|
||||
double res = 0.0;
|
||||
|
||||
req = wxT("SELECT SUM(amount) as amount FROM operation WHERE parent='") + id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, false);
|
||||
|
||||
if (set.NextRow())
|
||||
res = set.GetDouble(wxT("amount"));
|
||||
|
||||
set.Finalize();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Idem
|
||||
double Database::MetaPositiveAmount(const wxString& id)
|
||||
{
|
||||
wxSQLite3ResultSet set;
|
||||
wxString req;
|
||||
double res = 0.0;
|
||||
|
||||
req = wxT("SELECT SUM(amount) as amount FROM operation WHERE amount > 0 AND parent='") + id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, false);
|
||||
|
||||
if (set.NextRow())
|
||||
res = set.GetDouble(wxT("amount"));
|
||||
|
||||
set.Finalize();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void Database::SetAccountAmount(int month, int year, const wxString& accountId, double amount)
|
||||
|
@ -697,7 +793,7 @@ void Database::UpdateAccount(Account& ac)
|
|||
|
||||
if (!ac.shared && ac.is_owner)
|
||||
{
|
||||
req = wxT("DELETE FROM shared_account WHERE id='") + ac.id + wxT("'");
|
||||
req = wxT("DELETE FROM shared_account WHERE account='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
}
|
||||
|
@ -706,45 +802,66 @@ void Database::UpdateAccount(Account& ac)
|
|||
void Database::DeleteAccount(User* user, Account& ac)
|
||||
{
|
||||
wxString req;
|
||||
wxSQLite3ResultSet set;
|
||||
|
||||
if (ac.is_owner)
|
||||
{
|
||||
if (ac.shared)
|
||||
{
|
||||
req = wxT("DELETE FROM shared_account WHERE id='") + ac.id + wxT("'");
|
||||
req = wxT("DELETE FROM shared_account WHERE account='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
}
|
||||
req = wxT("DELETE FROM account WHERE id='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
}
|
||||
else
|
||||
{
|
||||
req = wxT("DELETE FROM shared_account WHERE user='") + user->_id + wxT("'");
|
||||
|
||||
req = wxT("DELETE FROM account_amount WHERE account='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
|
||||
req = wxT("SELECT COUNT(user) AS cnt FROM shared_account WHERE id='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, );
|
||||
|
||||
if (!set.GetInt(wxT("cnt")))
|
||||
{
|
||||
ac.shared = false;
|
||||
UpdateAccount(ac);
|
||||
}
|
||||
}
|
||||
else
|
||||
RemoveSharedAccount(ac, user->_id);
|
||||
}
|
||||
|
||||
void Database::AddSharedAccount(Account& ac, const wxString& granted)
|
||||
{
|
||||
wxString req;
|
||||
wxSQLite3ResultSet set;
|
||||
|
||||
req = wxT("INSERT INTO shared_account ('id', 'user') VALUES ('") + ac.id + wxT("', '") + granted + wxT("'");
|
||||
req = wxT("SELECT id FROM user WHERE name='") + granted + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, );
|
||||
|
||||
req = wxT("INSERT INTO shared_account ('account', 'user') VALUES ('") + ac.id + wxT("', '") + set.GetAsString(wxT("id")) + wxT("')");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
|
||||
if (!ac.shared)
|
||||
{
|
||||
ac.shared = true;
|
||||
UpdateAccount(ac);
|
||||
}
|
||||
}
|
||||
|
||||
void Database::RemoveSharedAccount(Account& ac, const wxString& granted)
|
||||
{
|
||||
wxString req;
|
||||
wxSQLite3ResultSet set;
|
||||
|
||||
req = wxT("DELETE FROM shared_account WHERE user='") + granted + wxT("' AND account='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
|
||||
req = wxT("SELECT COUNT(user) AS cnt FROM shared_account WHERE account='") + ac.id + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, );
|
||||
|
||||
if (!set.GetInt(wxT("cnt")))
|
||||
{
|
||||
ac.shared = false;
|
||||
UpdateAccount(ac);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
wxString Database::AddCategory(User* user, Category& category)
|
||||
|
@ -817,6 +934,35 @@ void Database::DeleteCategory(User* user, Category& category)
|
|||
EXECUTE_SQL_UPDATE(req, );
|
||||
}
|
||||
|
||||
bool Database::LoadCategory(const wxString& id, const wxString& name, Category& category)
|
||||
{
|
||||
wxSQLite3ResultSet set;
|
||||
wxString req;
|
||||
bool ret = false ;
|
||||
|
||||
if (id.Length())
|
||||
req = wxT("SELECT * FROM category WHERE id='") + id + wxT("'");
|
||||
else
|
||||
req = wxT("SELECT * FROM category WHERE name='") + name + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, false);
|
||||
|
||||
if (set.NextRow())
|
||||
{
|
||||
category.id = set.GetAsString(wxT("id"));
|
||||
category.parent = set.GetAsString(wxT("parent"));
|
||||
category.name = set.GetAsString(wxT("name"));
|
||||
category.backcolor = wxColour(set.GetAsString(wxT("backcolor")));
|
||||
category.forecolor = wxColour(set.GetAsString(wxT("forecolor")));
|
||||
category.font = set.GetAsString(wxT("font"));
|
||||
ret = true;
|
||||
}
|
||||
|
||||
set.Finalize();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::map<int, std::vector<int> > Database::GetAllOperations(User* user)
|
||||
{
|
||||
wxString req, req2, reqUnion;
|
||||
|
@ -1016,33 +1162,26 @@ void Database::KillMe(User* user)
|
|||
|
||||
if (!user->_accounts.empty())
|
||||
{
|
||||
for (it = user->_accounts.begin(); it != user->_accounts.end(); it++)
|
||||
DeleteAccount(user, *it);
|
||||
|
||||
it = user->_accounts.begin();
|
||||
req = wxT("DELETE FROM account_amount WHERE account IN('") + it->id;
|
||||
if (it->is_owner)
|
||||
req = wxT("DELETE FROM operation WHERE account IN('") + it->id;
|
||||
else
|
||||
req = wxT("DELETE FROM operation WHERE account IN('-1");
|
||||
it++;
|
||||
for (;it != user->_accounts.end(); it++)
|
||||
{
|
||||
req += wxT("', '") + it->id ;
|
||||
if (it->is_owner)
|
||||
req += wxT("', '") + it->id ;
|
||||
}
|
||||
req += wxT("')");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
|
||||
it = user->_accounts.begin();
|
||||
req = wxT("DELETE FROM operation WHERE account IN('") + it->id;
|
||||
it++;
|
||||
for (;it != user->_accounts.end(); it++)
|
||||
{
|
||||
req += wxT("', '") + it->id ;
|
||||
}
|
||||
req += wxT("')");
|
||||
req += wxT(" OR user='") + user->_id + wxT("'");
|
||||
req += wxT(" OR (user='") + user->_id + wxT("' AND account='')");
|
||||
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
}
|
||||
|
||||
req = wxT("DELETE FROM account WHERE user='") + user->_id + wxT("'");
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
|
||||
req = wxT("DELETE FROM category WHERE user='") + user->_id + wxT("'");
|
||||
EXECUTE_SQL_UPDATE(req, );
|
||||
|
||||
|
@ -1281,7 +1420,7 @@ void Database::GetStats(User* user, const wxString& monthFrom, const wxString& y
|
|||
|
||||
std::map<wxString, double>* Database::GetNotChecked(User* user, int month, int year)
|
||||
{
|
||||
std::vector<Account>::iterator accountIt;
|
||||
std::vector<Account>::iterator accountIt;
|
||||
std::map<wxString, double>* res = new std::map<wxString, double>;
|
||||
wxSQLite3ResultSet set;
|
||||
wxString req;
|
||||
|
@ -1304,3 +1443,44 @@ std::vector<Account>::iterator accountIt;
|
|||
|
||||
return res;
|
||||
}
|
||||
|
||||
std::map<wxString, wxString> Database::getSharedAccountOwners(const wxString& account)
|
||||
{
|
||||
std::map<wxString, wxString> res;
|
||||
wxSQLite3ResultSet set, set2;
|
||||
wxString req;
|
||||
|
||||
req = wxT("SELECT user FROM shared_account WHERE account='") + account + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, res);
|
||||
|
||||
while(set.NextRow())
|
||||
{
|
||||
req = wxT("SELECT name FROM user WHERE id='") + set.GetAsString(wxT("user")) + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set2, res);
|
||||
|
||||
res[set2.GetAsString(wxT("name"))] = set.GetAsString(wxT("user"));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
wxString Database::getSharedAccountOwner(const wxString& account)
|
||||
{
|
||||
wxSQLite3ResultSet set, set2;
|
||||
wxString req;
|
||||
|
||||
req = wxT("SELECT user FROM account WHERE id='") + account + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set, wxT(""));
|
||||
|
||||
while(set.NextRow())
|
||||
{
|
||||
req = wxT("SELECT name FROM user WHERE id='") + set.GetAsString(wxT("user")) + wxT("'");
|
||||
|
||||
EXECUTE_SQL_QUERY(req, set2, wxT(""));
|
||||
}
|
||||
|
||||
return set2.GetAsString(wxT("name"));
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#define INIT_SCRIPT "init.sql"
|
||||
|
||||
class KissCount;
|
||||
class User;
|
||||
|
||||
class Database
|
||||
{
|
||||
|
@ -50,6 +51,10 @@ public:
|
|||
wxString AddOperation(User* user, Operation& op);
|
||||
void DeleteOperation(Operation& op);
|
||||
void DeleteOperations(User* user, int month, int year);
|
||||
bool LoadOperation(User* user, const wxString& id);
|
||||
double MetaAmount(const wxString& id);
|
||||
double MetaPositiveAmount(const wxString& id);
|
||||
|
||||
double GetAccountAmount(const wxString& id, int month, int year);
|
||||
void SetAccountAmount(int month, int year, const wxString& accountId, double amount);
|
||||
|
||||
|
@ -57,10 +62,12 @@ public:
|
|||
void UpdateAccount(Account& ac);
|
||||
void DeleteAccount(User* user, Account& ac);
|
||||
void AddSharedAccount(Account& ac, const wxString& granted);
|
||||
void RemoveSharedAccount(Account& ac, const wxString& granted);
|
||||
|
||||
wxString AddCategory(User* user, Category& category);
|
||||
void UpdateCategory(Category& category);
|
||||
void DeleteCategory(User* user, Category& category);
|
||||
bool LoadCategory(const wxString& id, const wxString& name, Category& category);
|
||||
|
||||
std::map<int, std::vector<int> > GetAllOperations(User* user);
|
||||
void GenerateMonth(User* user, int monthFrom, int yearFrom, int monthTo, int yearTo);
|
||||
|
@ -82,6 +89,9 @@ public:
|
|||
|
||||
void KillMe(User* user);
|
||||
bool GetOperation(const wxString& id, Operation* op);
|
||||
std::map<wxString, wxString> getSharedAccountOwners(const wxString& account);
|
||||
wxString getSharedAccountOwner(const wxString& account);
|
||||
|
||||
std::map<wxString, double>* GetNotChecked(User* user, int month, int year);
|
||||
|
||||
private:
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#include "User.h"
|
||||
|
||||
User::User(Database* db) : _db(db)
|
||||
{}
|
||||
|
||||
User::~User()
|
||||
{
|
||||
std::map<unsigned int, std::map<unsigned int, std::vector<Operation> >* >::iterator it;
|
||||
|
@ -41,6 +44,9 @@ Category User::GetCategory(wxString& catId)
|
|||
if (it->id == catId)
|
||||
return *it;
|
||||
|
||||
if (_db->LoadCategory(catId, wxT(""), cat))
|
||||
return cat;
|
||||
|
||||
cat.id = wxT("0");
|
||||
cat.parent = wxT("0");
|
||||
cat.name = _("Unknown");
|
||||
|
@ -53,32 +59,46 @@ Category User::GetCategory(wxString& catId)
|
|||
|
||||
wxString User::GetCategoryName(wxString& catId)
|
||||
{
|
||||
Category cat;
|
||||
std::vector<Category>::iterator it;
|
||||
|
||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||
if (it->id == catId)
|
||||
return it->name;
|
||||
|
||||
if (_db->LoadCategory(catId, wxT(""), cat))
|
||||
return cat.name;
|
||||
|
||||
return _("Unknown") ;
|
||||
}
|
||||
|
||||
wxString User::GetCategoryId(wxString& catName)
|
||||
{
|
||||
std::vector<Category>::iterator it;
|
||||
Category cat;
|
||||
|
||||
for (it=_categories.begin(); it !=_categories.end(); it++)
|
||||
if (it->name == catName)
|
||||
return it->id;
|
||||
|
||||
if ( _db->LoadCategory(wxT(""), catName, cat))
|
||||
return cat.id;
|
||||
|
||||
return wxT("0") ;
|
||||
}
|
||||
|
||||
const wxFont& User::GetCategoryFont(wxString& catId)
|
||||
const wxFont User::GetCategoryFont(wxString& catId)
|
||||
{
|
||||
wxFont f;
|
||||
Category cat;
|
||||
|
||||
for (unsigned int i=0; i<_categories.size(); i++)
|
||||
if (_categories[i].id == catId)
|
||||
return _categoriesFonts[i];
|
||||
|
||||
if (_db->LoadCategory(catId, wxT(""), cat))
|
||||
return KissCount::ExtractFont(cat.font);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -176,9 +196,14 @@ void User::Group(const Operation& op)
|
|||
// Already into childs
|
||||
if (it2 != it->childs.end()) return;
|
||||
it->childs.push_back(op.id);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_db->LoadOperation(this, op.parent))
|
||||
{
|
||||
(*_operations[op.year])[op.month][(*_operations[op.year])[op.month].size()-1].childs.push_back(op.id);
|
||||
}
|
||||
}
|
||||
|
||||
void User::UnGroup(const Operation& op)
|
||||
|
|
|
@ -28,10 +28,14 @@
|
|||
#include "Category.h"
|
||||
#include "Account.h"
|
||||
#include "Operation.h"
|
||||
#include "Database.h"
|
||||
|
||||
class Database;
|
||||
|
||||
class User
|
||||
{
|
||||
public:
|
||||
User(Database* db);
|
||||
~User();
|
||||
|
||||
wxString _id;
|
||||
|
@ -46,7 +50,7 @@ public:
|
|||
Category GetCategory(wxString& catId);
|
||||
wxString GetCategoryName(wxString& catId);
|
||||
wxString GetCategoryId(wxString& catName);
|
||||
const wxFont& GetCategoryFont(wxString& catId);
|
||||
const wxFont GetCategoryFont(wxString& catId);
|
||||
wxString GetAccountName(const wxString& accountId);
|
||||
wxString GetAccountId(wxString& accountName);
|
||||
int GetCategoriesNumber();
|
||||
|
@ -57,6 +61,9 @@ public:
|
|||
void Group(const Operation& op);
|
||||
void UnGroup(const Operation& op);
|
||||
void ResolveGroups(int year);
|
||||
|
||||
private:
|
||||
Database* _db;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,7 +20,14 @@
|
|||
#ifndef MODEL_H
|
||||
#define MODEL_H
|
||||